diff --git a/config.h.meson b/config.h.meson index 9c84cf3b8..65ae3a676 100644 --- a/config.h.meson +++ b/config.h.meson @@ -29,9 +29,6 @@ /* Define to 1 if using `alloca.c'. */ #mesondefine C_ALLOCA -/* Whether to disable memory pools */ -#mesondefine DISABLE_MEM_POOLS - /* always defined to indicate that i18n is enabled */ #mesondefine ENABLE_NLS diff --git a/config.h.win32.in b/config.h.win32.in index 67ca4a17e..d104b143f 100644 --- a/config.h.win32.in +++ b/config.h.win32.in @@ -25,9 +25,6 @@ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ -/* Whether to disable memory pools */ -/* #undef DISABLE_MEM_POOLS */ - /* always defined to indicate that i18n is enabled */ #define ENABLE_NLS 1 diff --git a/configure.ac b/configure.ac index fdb5dcb53..5e39668b1 100644 --- a/configure.ac +++ b/configure.ac @@ -248,21 +248,8 @@ AC_ARG_ENABLE(debug, [turn on debugging @<:@default=glib_debug_default@:>@]),, enable_debug=glib_debug_default) -AC_ARG_ENABLE(mem_pools, - [AS_HELP_STRING([--disable-mem-pools], - [disable all glib memory pools])],, - [disable_mem_pools=no]) - GLIB_TESTS -AC_MSG_CHECKING([whether to disable memory pools]) -AS_IF([test "x$disable_mem_pools" = "xno"], [ - AC_MSG_RESULT([no]) -], [ - AC_DEFINE(DISABLE_MEM_POOLS, [1], [Whether to disable memory pools]) - AC_MSG_RESULT([yes]) -]) - dnl location to install runtime libraries, e.g. ../../lib to install dnl to /lib if libdir is /usr/lib AC_ARG_WITH(runtime-libdir, diff --git a/docs/macros.txt b/docs/macros.txt index 5ca0b941b..953616382 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 ---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 @@ -20,18 +18,6 @@ and/or third party code. Notes on GLib's internal and global macros ========================================== -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 diff --git a/docs/reference/glib/building.xml b/docs/reference/glib/building.xml index 6c1a0c2d5..b131c7561 100644 --- a/docs/reference/glib/building.xml +++ b/docs/reference/glib/building.xml @@ -227,47 +227,6 @@ - - <option>--disable-mem-pools</option> and - <option>--enable-mem-pools</option> - - - 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() - and g_free() functions. Code currently affected by - this: - - - - 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 - - - - - - <option>--with-threads</option> diff --git a/glib/gbsearcharray.h b/glib/gbsearcharray.h index 832522e27..39afa3f79 100644 --- a/glib/gbsearcharray.h +++ b/glib/gbsearcharray.h @@ -116,11 +116,7 @@ static inline void g_bsearch_array_free (GBSearchArray /* --- implementation --- */ /* helper macro to cut down realloc()s */ -#ifdef DISABLE_MEM_POOLS -#define G_BSEARCH_UPPER_POWER2(n) (n) -#else /* !DISABLE_MEM_POOLS */ #define G_BSEARCH_UPPER_POWER2(n) ((n) ? 1 << g_bit_storage ((n) - 1) : 0) -#endif /* !DISABLE_MEM_POOLS */ #define G_BSEARCH_ARRAY_NODES(barray) (((guint8*) (barray)) + sizeof (GBSearchArray)) static inline GBSearchArray* g_bsearch_array_create (const GBSearchConfig *bconfig) diff --git a/gobject/gtype.c b/gobject/gtype.c index 84f3c9a1c..75ff36c8a 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -1132,11 +1132,7 @@ type_data_make_W (TypeNode *node, data->instance.class_private_size = 0; if (pnode) data->instance.class_private_size = pnode->data->instance.class_private_size; -#ifdef DISABLE_MEM_POOLS - data->instance.n_preallocs = 0; -#else /* !DISABLE_MEM_POOLS */ data->instance.n_preallocs = MIN (info->n_preallocs, 1024); -#endif /* !DISABLE_MEM_POOLS */ data->instance.instance_init = info->instance_init; } else if (node->is_classed) /* only classed */ diff --git a/gobject/gvaluearray.c b/gobject/gvaluearray.c index 6648c7318..553152d5a 100644 --- a/gobject/gvaluearray.c +++ b/gobject/gvaluearray.c @@ -57,12 +57,7 @@ * ]| */ - -#ifdef DISABLE_MEM_POOLS -# define GROUP_N_VALUES (1) /* power of 2 !! */ -#else -# define GROUP_N_VALUES (8) /* power of 2 !! */ -#endif +#define GROUP_N_VALUES (8) /* power of 2 !! */ /* --- functions --- */ @@ -108,18 +103,6 @@ value_array_grow (GValueArray *value_array, } } -static inline void -value_array_shrink (GValueArray *value_array) -{ -#ifdef DISABLE_MEM_POOLS - if (value_array->n_prealloced >= value_array->n_values + GROUP_N_VALUES) - { - value_array->n_prealloced = (value_array->n_values + GROUP_N_VALUES - 1) & ~(GROUP_N_VALUES - 1); - value_array->values = g_renew (GValue, value_array->values, value_array->n_prealloced); - } -#endif -} - /** * g_value_array_new: * @n_prealloced: number of values to preallocate space for @@ -316,7 +299,6 @@ g_value_array_remove (GValueArray *value_array, if (index < value_array->n_values) memmove (value_array->values + index, value_array->values + index + 1, (value_array->n_values - index) * sizeof (value_array->values[0])); - value_array_shrink (value_array); if (value_array->n_prealloced > value_array->n_values) memset (value_array->values + value_array->n_values, 0, sizeof (value_array->values[0]));