mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-19 12:11:57 +02:00
build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro
It's mostly not used anymore and doesn't do what it says it does. The docs state that it affects GList, GSList, GNode, GMemChunks, GSignal, GType n_preallocs and GBSearchArray while: * GList, GSList and GNode use GSlice and are not affected * GMemChunks is gone * GType npreallocs is ignored It also states that it can be used to force the usage of g_malloc/g_free, which is handled by G_SLICE=always-malloc now. The only places where it's used is in signal handling through GBSearchArray and in GValueArray (deprecated). Since it's unlikely that anyone wants to reduce allocation sizes just for those cases remove the build option.
This commit is contained in:
parent
553df9dcaf
commit
3aa23078ac
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
13
configure.ac
13
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,
|
||||
|
@ -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
|
||||
|
@ -227,47 +227,6 @@
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><option>--disable-mem-pools</option> and
|
||||
<option>--enable-mem-pools</option></title>
|
||||
|
||||
<para>
|
||||
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 <function>g_malloc()</function>
|
||||
and <function>g_free()</function> functions. Code currently affected by
|
||||
this:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<structname>GMemChunk</structname>s become basically non-effective
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<structname>GSignal</structname> disables all caching
|
||||
(potentially very slow)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<structname>GType</structname> doesn't honour the
|
||||
<structname>GTypeInfo</structname>
|
||||
<structfield>n_preallocs</structfield> field anymore
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
the <structname>GBSearchArray</structname> flag
|
||||
<literal>G_BSEARCH_ALIGN_POWER2</literal> becomes non-functional
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><option>--with-threads</option></title>
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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]));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user