summaryrefslogtreecommitdiffstats
path: root/src/zone.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2012-11-09 19:44:03 (GMT)
committerJason Evans <jasone@canonware.com>2012-11-09 19:44:03 (GMT)
commit87499f6748ebe4817571e817e9f680ccb5bf54a9 (patch)
treea98396797d7550a3ceb04e7ddaed7bb8b27f13d7 /src/zone.c
parent3b1f3aca54fede23299cde9034f7b909c3d290d7 (diff)
parent556ddc7fa94f13c388ec6c9d2d54ace250540f2c (diff)
downloadjemalloc-3.2.0.zip
jemalloc-3.2.0.tar.gz
jemalloc-3.2.0.tar.bz2
Merge branch 'dev'3.2.0
Diffstat (limited to 'src/zone.c')
-rw-r--r--src/zone.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/zone.c b/src/zone.c
index cde5d49..c62c183 100644
--- a/src/zone.c
+++ b/src/zone.c
@@ -171,6 +171,16 @@ 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.malloc = (void *)zone_malloc;
zone.calloc = (void *)zone_calloc;
@@ -241,7 +251,7 @@ register_zone(void)
* then becomes the default.
*/
do {
- malloc_zone_t *default_zone = malloc_default_zone();
+ default_zone = malloc_default_zone();
malloc_zone_unregister(default_zone);
malloc_zone_register(default_zone);
} while (malloc_default_zone() != &zone);