honour g_mem_gc_friendly settings when freeing slices, make sure

Wed Jan 25 16:39:18 2006  Tim Janik  <timj@imendio.com>

        * glib/gslice.c: honour g_mem_gc_friendly settings when freeing
        slices, make sure g_mem_gc_friendly is properly initialized.

        * gmem.[hc]: ensure g_mem_gc_friendly is initialized from G_DEBUG upon
        the first allocation. applied some branching optimizations.

        * docs/macros.txt: reflected --enable-gc-friendly change and
        described ENABLE_GC_FRIENDLY_DEFAULT as well as G_DEBUG=gc-friendly.

        * configure.in: changed --enable-gc-friendly=yes to define
        ENABLE_GC_FRIENDLY_DEFAULT.

        * glib/garray.c: changed ENABLE_GC_FRIENDLY macro #ifdef-s to
        if (G_UNLIKELY (g_mem_gc_friendly)).

        * glib/gtree.c:
        * glib/ghash.c: removed ENABLE_GC_FRIENDLY code which is now taken
        care of by g_slice_free1().

        * tests/slice-test.c: fixed leaks, reported by Kjartan Maraas.
This commit is contained in:
Tim Janik
2006-01-25 15:51:43 +00:00
committed by Tim Janik
parent 7b744cf4d2
commit eda944bca5
12 changed files with 187 additions and 81 deletions

View File

@@ -10,7 +10,7 @@ GLib's configure options and corresponding macros
--enable-debug=yes [default for development branches]
-DG_ENABLE_DEBUG -g
--enable-gc-friendly=yes
#define ENABLE_GC_FRIENDLY 1
#define ENABLE_GC_FRIENDLY_DEFAULT 1
--disable-mem-pools=yes
#define DISABLE_MEM_POOLS 1
@@ -23,11 +23,13 @@ Notes on GLib's internal and global macros
==========================================
ENABLE_GC_FRIENDLY
ENABLE_GC_FRIENDLY_DEFAULT
Newly allocated memory that isn't directly initialized, as well
as memory being freed should be reset to 0. The point here is to
allow memory checkers and similar programs that use bohem GC alike
algorithms to produce more accurate results.
This can also be accomplished by setting the environment variable
G_DEBUG=gc-friendly.
DISABLE_MEM_POOLS
Many small chunks of memory are often allocated via collective pools
in GLib and are cached after release to speed up reallocations.