From ce0ad84a78238407087509e8617cb88eb191a556 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 23 Jun 2007 21:18:05 +0000 Subject: [PATCH] Add a clarification about pairing the memory allocation and free 2007-06-23 Emmanuele Bassi * 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 | 7 +++++++ docs/reference/glib/tmpl/memory.sgml | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 868e48e95..28578b765 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,10 @@ +2007-06-23 Emmanuele Bassi + + * 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 * === Released 2.13.5 === diff --git a/docs/reference/glib/tmpl/memory.sgml b/docs/reference/glib/tmpl/memory.sgml index 622e05598..a9f2fa6bb 100644 --- a/docs/reference/glib/tmpl/memory.sgml +++ b/docs/reference/glib/tmpl/memory.sgml @@ -8,6 +8,7 @@ general memory-handling. These functions provide support for allocating and freeing memory. + 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. + + +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(). + + +