[glib] Bug 448888 - don't init g_slice for always-malloc
- From: Ryan Lortie <ryanl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] Bug 448888 - don't init g_slice for always-malloc
- Date: Sat, 23 Jan 2010 01:24:13 +0000 (UTC)
commit c8fc3112f910b544ace0e1cb14d47555b38be6d8
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jan 22 20:18:58 2010 -0500
Bug 448888 - don't init g_slice for always-malloc
glib/gslice.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/glib/gslice.c b/glib/gslice.c
index 70f9efa..c73884b 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -325,14 +325,24 @@ g_slice_init_nomessage (void)
/* we can only align to system page size */
allocator->max_page_size = sys_page_size;
#endif
+ if (allocator->config.always_malloc)
+ {
+ allocator->contention_counters = NULL;
+ allocator->magazines = NULL;
+ allocator->slab_stack = NULL;
+ }
+ else
+ {
+ allocator->contention_counters = g_new0 (guint, MAX_SLAB_INDEX (allocator));
+ allocator->magazines = g_new0 (ChunkLink*, MAX_SLAB_INDEX (allocator));
+ allocator->slab_stack = g_new0 (SlabInfo*, MAX_SLAB_INDEX (allocator));
+ }
+
allocator->magazine_mutex = NULL; /* _g_slice_thread_init_nomessage() */
- allocator->magazines = g_new0 (ChunkLink*, MAX_SLAB_INDEX (allocator));
- allocator->contention_counters = g_new0 (guint, MAX_SLAB_INDEX (allocator));
allocator->mutex_counter = 0;
allocator->stamp_counter = MAX_STAMP_COUNTER; /* force initial update */
allocator->last_stamp = 0;
allocator->slab_mutex = NULL; /* _g_slice_thread_init_nomessage() */
- allocator->slab_stack = g_new0 (SlabInfo*, MAX_SLAB_INDEX (allocator));
allocator->color_accu = 0;
magazine_cache_update_stamp();
/* values cached for performance reasons */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]