Bug 448888 - don't init g_slice for always-malloc

This commit is contained in:
Ryan Lortie 2010-01-22 20:18:58 -05:00
parent 7693b0af44
commit c8fc3112f9

View File

@ -325,14 +325,24 @@ g_slice_init_nomessage (void)
/* we can only align to system page size */ /* we can only align to system page size */
allocator->max_page_size = sys_page_size; allocator->max_page_size = sys_page_size;
#endif #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->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->mutex_counter = 0;
allocator->stamp_counter = MAX_STAMP_COUNTER; /* force initial update */ allocator->stamp_counter = MAX_STAMP_COUNTER; /* force initial update */
allocator->last_stamp = 0; allocator->last_stamp = 0;
allocator->slab_mutex = NULL; /* _g_slice_thread_init_nomessage() */ allocator->slab_mutex = NULL; /* _g_slice_thread_init_nomessage() */
allocator->slab_stack = g_new0 (SlabInfo*, MAX_SLAB_INDEX (allocator));
allocator->color_accu = 0; allocator->color_accu = 0;
magazine_cache_update_stamp(); magazine_cache_update_stamp();
/* values cached for performance reasons */ /* values cached for performance reasons */