• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3GLib's configure options and corresponding macros
4=================================================
5
6--enable-debug=no
7	-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS
8--enable-debug=minimum	[default for stable branches]
9	none
10--enable-debug=yes	[default for development branches]
11	-DG_ENABLE_DEBUG -g
12--enable-gc-friendly=yes
13	#define ENABLE_GC_FRIENDLY_DEFAULT 1
14--disable-mem-pools=yes
15	#define DISABLE_MEM_POOLS 1
16
17Besides these, there are some local feature specific options, but my main
18focus here is to concentrate on macros that affect overall GLib behaviour
19and/or third party code.
20
21
22Notes on GLib's internal and global macros
23==========================================
24
25
26ENABLE_GC_FRIENDLY_DEFAULT
27	Newly allocated memory that isn't directly initialized, as well
28	as memory being freed should be reset to 0. The point here is to
29	allow memory checkers and similar programs that use bohem GC alike
30	algorithms to produce more accurate results.
31	This can also be accomplished by setting the environment variable
32	G_DEBUG=gc-friendly.
33DISABLE_MEM_POOLS
34	Many small chunks of memory are often allocated via collective pools
35	in GLib and are cached after release to speed up reallocations.
36	For sparse memory systems this behaviour is often inferior, so
37	memory pools can be disabled to avoid excessive caching and force
38	atomic maintenance of chunks through the g_malloc/g_free.
39	Code currently affected by this macro:
40	- GList, GSList, GNode allocations
41	- GMemChunks become basically non-effective
42	- GSignal disables all caching (potentially very slow)
43	- GType doesn't honour the GTypeInfo n_preallocs field anymore
44	- the GBSearchArray flag G_BSEARCH_ALIGN_POWER2 becomes non-functional
45G_DISABLE_ASSERT
46	The g_assert() and g_assert_not_reached() become non-functional
47	with this define. The motivation is to speed up end-user apps by
48	avoiding expensive checks.
49	This macro can affect third-party code. --enable-debug=no will only
50	disable the assertion macros for GLib itself, but third-party code
51	that passes -DG_DISABLE_ASSERT to the compiler upon its own build
52	will end up with the non-functional variants after including glib.h
53	as well.
54	NOTE: Code inside the assertion macros should not have side effects
55	that affect the operation of the program.
56G_DISABLE_CHECKS
57	This macro is similar to G_DISABLE_ASSERT, it affects third-party
58	code as mentioned above and the NOTE about G_DISABLE_ASSERT applies
59	too. The macros that become non-functional here are
60	g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and
61	g_return_val_if_reached().
62	Additionally the glib_mem_profiler_table and g_mem_profile() from
63	gmem.h become non-functional if this macro is supplied.
64	This macro also switches off certain checks in the GSignal code.
65G_ENABLE_DEBUG
66	Quite a bit of additional debugging code is compiled into GLib for this
67	macro, and since it is a globally visible define, third-party code may
68	be affected by it similar to G_DISABLE_ASSERT.
69	The additional code executed/compiled for this macro currently involve:
70	- extra validity checks for GDate
71	- memory profiling traps in gmem.c (consult debugging.txt for details)
72	- BREAKPOINT abortion for fatal log levels in gmessage.c instead of
73	  plain abort() to allow debuggers trapping and overriding them
74	- added verbosity of gscanner.c to catch deprecated code paths
75	- added verbosity of gutils.c to catch deprecated code paths
76	- object ref/unref traps (consult debugging.txt) and object bookkeeping
77	  in gobject.c
78	- extra validity checks in gsignal.c
79
80
812000/12/28	Tim Janik
82