Commit a3c061a8 authored by Xavier Claessens's avatar Xavier Claessens
Browse files

Merge branch 'remove-gc-friendly-default' into 'master'

Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option

See merge request GNOME/glib!43
parents 09b8c6d2 118332dd
......@@ -32,9 +32,6 @@
/* Whether to disable memory pools */
#mesondefine DISABLE_MEM_POOLS
/* Whether to enable GC friendliness by default */
#mesondefine ENABLE_GC_FRIENDLY_DEFAULT
/* always defined to indicate that i18n is enabled */
#mesondefine ENABLE_NLS
......
......@@ -28,9 +28,6 @@
/* Whether to disable memory pools */
/* #undef DISABLE_MEM_POOLS */
/* Whether to enable GC friendliness by default */
/* #undef ENABLE_GC_FRIENDLY_DEFAULT */
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
......
......@@ -248,10 +248,6 @@ AC_ARG_ENABLE(debug,
[turn on debugging @<:@default=glib_debug_default@:>@]),,
enable_debug=glib_debug_default)
AC_ARG_ENABLE(gc_friendly,
[AS_HELP_STRING([--enable-gc-friendly],
[turn on garbage collector friendliness [default=no]])],,
[enable_gc_friendly=no])
AC_ARG_ENABLE(mem_pools,
[AS_HELP_STRING([--disable-mem-pools],
[disable all glib memory pools])],,
......@@ -259,12 +255,6 @@ AC_ARG_ENABLE(mem_pools,
GLIB_TESTS
AC_MSG_CHECKING([whether to enable garbage collector friendliness])
AS_IF([test "x$enable_gc_friendly" = "xyes"], [
AC_DEFINE(ENABLE_GC_FRIENDLY_DEFAULT, 1, [Whether to enable GC friendliness by default])
AC_MSG_RESULT([yes])
], [ AC_MSG_RESULT([no]) ])
AC_MSG_CHECKING([whether to disable memory pools])
AS_IF([test "x$disable_mem_pools" = "xno"], [
AC_MSG_RESULT([no])
......
......@@ -9,8 +9,6 @@ GLib's configure options and corresponding macros
none
--enable-debug=yes [default for development branches]
-DG_ENABLE_DEBUG -g
--enable-gc-friendly=yes
#define ENABLE_GC_FRIENDLY_DEFAULT 1
--disable-mem-pools=yes
#define DISABLE_MEM_POOLS 1
......@@ -22,14 +20,6 @@ and/or third party code.
Notes on GLib's internal and global macros
==========================================
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.
......
......@@ -227,66 +227,6 @@
</para>
</formalpara>
<formalpara>
<title><option>--disable-gc-friendly</option> and
<option>--enable-gc-friendly</option></title>
<para>
By default, and with <option>--disable-gc-friendly</option>
as well, GLib does not clear the memory for certain objects before
they are freed. For example, GLib may decide to recycle GList nodes
by putting them in a free list. However, memory profiling and debugging
tools like <ulink url="http://www.valgrind.org">Valgrind</ulink> work
better if an application does not keep dangling pointers to freed
memory (even though these pointers are no longer dereferenced), or
invalid pointers inside uninitialized memory.
The <option>--enable-gc-friendly</option> option makes GLib
clear memory in these situations:
</para>
<itemizedlist>
<listitem>
<para>
When shrinking a GArray, GLib will clear the memory no longer
available in the array: shrink an array from 10 bytes to 7, and
the last 3 bytes will be cleared. This includes removals of single
and multiple elements.
</para>
</listitem>
<listitem>
<para>
When growing a GArray, GLib will clear the new chunk of memory.
Grow an array from 7 bytes to 10 bytes, and the last 3 bytes will
be cleared.
</para>
</listitem>
<listitem>
<para>
The above applies to GPtrArray as well.
</para>
</listitem>
<listitem>
<para>
When freeing a node from a GHashTable, GLib will first clear
the node, which used to have pointers to the key and the value
stored at that node.
</para>
</listitem>
<listitem>
<para>
When destroying or removing a GTree node, GLib will clear the node,
which used to have pointers to the node's value, and the left and
right subnodes.
</para>
</listitem>
</itemizedlist>
<para>
Since clearing the memory has a cost,
<option>--disable-gc-friendly</option> is the default.
</para>
</formalpara>
<formalpara>
<title><option>--disable-mem-pools</option> and
<option>--enable-mem-pools</option></title>
......
......@@ -74,11 +74,8 @@ G_STATIC_ASSERT (_g_alignof (TestInt) == _g_alignof (int));
* This variable is %TRUE if the `G_DEBUG` environment variable
* includes the key `gc-friendly`.
*/
#ifdef ENABLE_GC_FRIENDLY_DEFAULT
gboolean g_mem_gc_friendly = TRUE;
#else
gboolean g_mem_gc_friendly = FALSE;
#endif
GLogLevelFlags g_log_msg_prefix = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_WARNING |
G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_DEBUG;
GLogLevelFlags g_log_always_fatal = G_LOG_FATAL_MASK;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment