mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Merge branch 'remove-disable-mem-pools' into 'master'
build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro See merge request GNOME/glib!52
This commit is contained in:
commit
05fe110635
@ -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…
Reference in New Issue
Block a user