Add a clarification about pairing the memory allocation and free
authorEmmanuele Bassi <ebassi@gnome.org>
Sat, 23 Jun 2007 21:18:05 +0000 (21:18 +0000)
committerEmmanuele Bassi <ebassi@src.gnome.org>
Sat, 23 Jun 2007 21:18:05 +0000 (21:18 +0000)
2007-06-23  Emmanuele Bassi  <ebassi@gnome.org>

* glib/tmpl/memory.sgml: Add a clarification about pairing the
memory allocation and free functions, and not mix system's
malloc/free with the corresponding GLib ones. (#450216, Hubert
Figuiere)

svn path=/trunk/; revision=5586

docs/reference/ChangeLog
docs/reference/glib/tmpl/memory.sgml

index 868e48e95ddcb5994d61af91cd3c74b7d907e978..28578b765ff33b897bc023089ff22dce295b969a 100644 (file)
@@ -1,3 +1,10 @@
+2007-06-23  Emmanuele Bassi  <ebassi@gnome.org>
+
+       * glib/tmpl/memory.sgml: Add a clarification about pairing the
+       memory allocation and free functions, and not mix system's
+       malloc/free with the corresponding GLib ones. (#450216, Hubert
+       Figuiere)
+
 2007-06-18  Matthias Clasen  <mclasen@redhat.com>
 
        * === Released 2.13.5 ===
index 622e0559899affa85d04a5c14c2996ae90209bb7..a9f2fa6bb6309ac3ef608b683f22c2a3a6adf53b 100644 (file)
@@ -8,6 +8,7 @@ general memory-handling.
 <para>
 These functions provide support for allocating and freeing memory.
 </para>
+
 <note>
 <para>
 If any call to allocate memory fails, the application is terminated.
@@ -15,6 +16,16 @@ This also means that there is no need to check if the call succeeded.
 </para>
 </note>
 
+<note>
+<para>
+It's important to match g_malloc() with g_free(), plain malloc() with free(),
+and (if you're using C++) new with delete and new[] with delete[]. Otherwise
+bad things can happen, since these allocators may use different memory
+pools (and new/delete call constructors and destructors). See also
+g_mem_set_vtable().
+</para>
+</note>
+
 <!-- ##### SECTION See_Also ##### -->
 <para>