[glib: 1/2] Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option



commit 118332dd5c909eb1460962037d48c8361064148a
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu May 31 06:59:10 2018 +0200

    Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option
    
    ENABLE_GC_FRIENDLY_DEFAULT was supposed to set the default for the gc friendliness
    while still allowing to force enable it at runtime with G_DEBUG=gc-friendly.
    
    With commit 943a18b56434 (6 years ago) things were changed to always set it
    according to the content of G_DEBUG in glib_init(), making the default unused.
    
    Since nobody complained since then just remove the macro and the build option.

 config.h.meson                   |  3 --
 config.h.win32.in                |  3 --
 configure.ac                     | 10 -------
 docs/macros.txt                  | 10 -------
 docs/reference/glib/building.xml | 60 ----------------------------------------
 glib/glib-init.c                 |  5 +---
 6 files changed, 1 insertion(+), 90 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index fd0bfcaf9..3dae039f1 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -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
 
diff --git a/config.h.win32.in b/config.h.win32.in
index 14ac11d39..dfe0ccc66 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -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
 
diff --git a/configure.ac b/configure.ac
index be48c9a19..513cac83b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/docs/macros.txt b/docs/macros.txt
index 8b4202987..5ca0b941b 100644
--- a/docs/macros.txt
+++ b/docs/macros.txt
@@ -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.
diff --git a/docs/reference/glib/building.xml b/docs/reference/glib/building.xml
index 57c3c8c7d..6c1a0c2d5 100644
--- a/docs/reference/glib/building.xml
+++ b/docs/reference/glib/building.xml
@@ -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>
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 5f312113a..2e229667f 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]