mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-05 08:56:16 +01:00
782a8e2e7c
Thu Dec 28 10:21:46 2000 Tim Janik <timj@gtk.org> * gmem.[hc]: got rid of outdated dmalloc support. provide g_try_malloc() and g_try_realloc() which _may_ fail and return NULL. nuked g_mem_check(), provided GMemVTable for memory function virtualization, alterable at program startup with g_mem_set_vtable(). provided glib_mem_profiler_table and g_mem_profile() to support limited profiling information out of the box (uses mprotect() for free()ed areas on linux). provide globally visible G_MEM_ALIGN. buncha cleanups. * docs/macros.txt: file to get a clue about the various configuration macros. * docs/debugging.txt: explain debugging traps. * configure.in: got rid of --enable-mem-check and --enable-mem-profile, define GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. check malloc prototypes and define SANE_MALLOC_PROTOS is we can use them. <boy, is this file a mess> * gutils.c, gscanner.c: fix up compatibility warnings, use g_message(). Thu Dec 28 11:36:44 2000 Tim Janik <timj@gtk.org> * gbsearcharray.c (upper_power2): disable G_BSEARCH_ALIGN_POWER2 fucntionality if DISABLE_MEM_POOLS is defined. * gtype.c: honour DISABLE_MEM_POOLS. * gsignal.c (g_signal_init): flag signal key bsearch array with G_BSEARCH_ALIGN_POWER2 to avoid excessive growth time. honour DISABLE_MEM_POOLS. * gparam.h: added G_PARAM_READWRITE alias for (G_PARAM_READABLE | G_PARAM_WRITABLE).
80 lines
3.4 KiB
Plaintext
80 lines
3.4 KiB
Plaintext
|
|
|
|
GLib's configure options and corresponding macros
|
|
=================================================
|
|
|
|
--enable-debug=no
|
|
-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS
|
|
--enable-debug=minimum [default for stable branches]
|
|
none
|
|
--enable-debug=yes [default for development branches]
|
|
-DG_ENABLE_DEBUG -g
|
|
--enable-gc-friendly=yes
|
|
#define ENABLE_GC_FRIENDLY 1
|
|
--disable-mem-pools=yes
|
|
#define DISABLE_MEM_POOLS 1
|
|
|
|
Besides these, there are some local feature specific options, but my main
|
|
focus here is to concentrate on macros that affect overall GLib behaviour
|
|
and/or third party code.
|
|
|
|
|
|
Notes on GLib's internal and global macros
|
|
==========================================
|
|
|
|
|
|
ENABLE_GC_FRIENDLY
|
|
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.
|
|
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.
|
|
For sparse memory systems this behaviour is often inferior, so
|
|
memory pools can be disabled to avoid excessive caching and force
|
|
atomic maintenance of chunks through the g_malloc/g_free.
|
|
Code currently affected by this macro:
|
|
- GList, GSList, GNode allocations
|
|
- GMemChunks become basically non-effective
|
|
- GSignal disables all caching (potentially very slow)
|
|
- GType doesn't honour the GTypeInfo n_preallocs field anymore
|
|
- the GBSearchArray flag G_BSEARCH_ALIGN_POWER2 becomes non-functional
|
|
G_DISABLE_ASSERT
|
|
The g_assert() and g_assert_not_reached() become non-functional
|
|
with this define. The motivation is to speed up end-user apps by
|
|
avoiding expensive checks.
|
|
This macro can affect third-party code. --enable-debug=no will only
|
|
disable the assertion macros for GLib itself, but third-party code
|
|
that passes -DG_DISABLE_ASSERT to the compiler upon its own build
|
|
will end up with the non-functional variants after including glib.h
|
|
as well.
|
|
NOTE: Code inside the assertion macros should not have side effects
|
|
that affect the operation of the program.
|
|
G_DISABLE_CHECKS
|
|
This macro is similar to G_DISABLE_ASSERT, it affects third-party
|
|
code as mentioned above and the NOTE about G_DISABLE_ASSERT applies
|
|
too. The macros that become non-functional here are
|
|
g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and
|
|
g_return_val_if_reached().
|
|
Additionally the glib_mem_profiler_table and g_mem_profile() from
|
|
gmem.h become non-functional if this macro is supplied.
|
|
This macro also switches off certain checks in the GSignal code.
|
|
G_ENABLE_DEBUG
|
|
Quite a bit of additional debugging code is compiled into GLib for this
|
|
macro, and since it is a globally visible define, third-party code may
|
|
be affected by it similar to G_DISABLE_ASSERT.
|
|
The additional code executed/compiled for this macro currently involve:
|
|
- extra validity checks for GDate
|
|
- memory profiling traps in gmem.c (consult debugging.txt for details)
|
|
- BREAKPOINT abortion for fatal log levels in gmessage.c instead of
|
|
plain abort() to allow debuggers trapping and overriding them
|
|
- added verbosity of gscanner.c to catch deprecated code paths
|
|
- added verbosity of gutils.c to catch deprecated code paths
|
|
- object ref/unref traps (consult debugging.txt) and object bookkeeping
|
|
in gobject.c
|
|
- extra validity checks in gsignal.c
|
|
|
|
|
|
2000/12/28 Tim Janik
|