Bug 431221: Disable glib slice allocator, r=benjamin

Disable glib's slice sub-allocator[1], which is implemented as a zone allocator
layered on top of malloc.  Since jemalloc is itself a zone allocator, the extra
abstraction level forces segregation of equal-sized objects that could
otherwise be packed together.

[1] http://library.gnome.org/devel/glib/stable/glib-Memory-Slices.html
This commit is contained in:
Jason Evans 2008-06-20 10:34:42 -07:00
parent 16e8825a75
commit ce9c15f840

View File

@ -2775,6 +2775,12 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
#endif
#if defined(MOZ_WIDGET_GTK2)
#ifdef MOZ_MEMORY
// Disable the slice allocator, since jemalloc already uses similar layout
// algorithms, and using a sub-allocator tends to increase fragmentation.
// This must be done before g_thread_init() is called.
g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
#endif
g_thread_init(NULL);
// setup for private colormap. Ideally we'd like to do this
// in nsAppShell::Create, but we need to get in before gtk