Don't register jemalloc's zone allocator if something else already replaced the system default zone
This commit is contained in:
parent
e3d13060c8
commit
847ff223de
12
src/zone.c
12
src/zone.c
@ -171,6 +171,16 @@ void
|
|||||||
register_zone(void)
|
register_zone(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If something else replaced the system default zone allocator, don't
|
||||||
|
* register jemalloc's.
|
||||||
|
*/
|
||||||
|
malloc_zone_t *default_zone = malloc_default_zone();
|
||||||
|
if (!default_zone->zone_name ||
|
||||||
|
strcmp(default_zone->zone_name, "DefaultMallocZone") != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zone.size = (void *)zone_size;
|
zone.size = (void *)zone_size;
|
||||||
zone.malloc = (void *)zone_malloc;
|
zone.malloc = (void *)zone_malloc;
|
||||||
zone.calloc = (void *)zone_calloc;
|
zone.calloc = (void *)zone_calloc;
|
||||||
@ -241,7 +251,7 @@ register_zone(void)
|
|||||||
* then becomes the default.
|
* then becomes the default.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
malloc_zone_t *default_zone = malloc_default_zone();
|
default_zone = malloc_default_zone();
|
||||||
malloc_zone_unregister(default_zone);
|
malloc_zone_unregister(default_zone);
|
||||||
malloc_zone_register(default_zone);
|
malloc_zone_register(default_zone);
|
||||||
} while (malloc_default_zone() != &zone);
|
} while (malloc_default_zone() != &zone);
|
||||||
|
Loading…
Reference in New Issue
Block a user