From 80b25932ca52e9506d4e2b8ee0fa58aa5ae3306d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 2 Apr 2012 09:04:54 +0200 Subject: [PATCH] Move last bit of zone initialization in zone.c, and lazy-initialize --- .../jemalloc/internal/jemalloc_internal.h.in | 12 ---------- include/jemalloc/internal/zone.h | 22 ------------------- src/jemalloc.c | 11 ---------- src/zone.c | 1 + 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 include/jemalloc/internal/zone.h diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in index 9e57b62b..db2deb03 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -304,9 +304,6 @@ static const bool config_ivsalloc = #include "jemalloc/internal/rtree.h" #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/hash.h" -#ifdef JEMALLOC_ZONE -#include "jemalloc/internal/zone.h" -#endif #include "jemalloc/internal/prof.h" #undef JEMALLOC_H_TYPES @@ -332,9 +329,6 @@ static const bool config_ivsalloc = #include "jemalloc/internal/rtree.h" #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/hash.h" -#ifdef JEMALLOC_ZONE -#include "jemalloc/internal/zone.h" -#endif #include "jemalloc/internal/prof.h" typedef struct { @@ -400,9 +394,6 @@ void jemalloc_postfork_child(void); #include "jemalloc/internal/rtree.h" #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/hash.h" -#ifdef JEMALLOC_ZONE -#include "jemalloc/internal/zone.h" -#endif #include "jemalloc/internal/prof.h" #undef JEMALLOC_H_EXTERNS @@ -565,9 +556,6 @@ choose_arena(void) #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/arena.h" #include "jemalloc/internal/hash.h" -#ifdef JEMALLOC_ZONE -#include "jemalloc/internal/zone.h" -#endif #ifndef JEMALLOC_ENABLE_INLINE void *imalloc(size_t size); diff --git a/include/jemalloc/internal/zone.h b/include/jemalloc/internal/zone.h deleted file mode 100644 index 9eb4252f..00000000 --- a/include/jemalloc/internal/zone.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef JEMALLOC_ZONE -# error "This source file is for zones on Darwin (OS X)." -#endif -/******************************************************************************/ -#ifdef JEMALLOC_H_TYPES - -#endif /* JEMALLOC_H_TYPES */ -/******************************************************************************/ -#ifdef JEMALLOC_H_STRUCTS - -#endif /* JEMALLOC_H_STRUCTS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_EXTERNS - -void register_zone(void); - -#endif /* JEMALLOC_H_EXTERNS */ -/******************************************************************************/ -#ifdef JEMALLOC_H_INLINES - -#endif /* JEMALLOC_H_INLINES */ -/******************************************************************************/ diff --git a/src/jemalloc.c b/src/jemalloc.c index 5b1e0fdd..1deabcd9 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -717,17 +717,6 @@ malloc_init_hard(void) return (false); } -#ifdef JEMALLOC_ZONE -JEMALLOC_ATTR(constructor) -void -jemalloc_darwin_init(void) -{ - - if (malloc_init_hard() == false) - register_zone(); -} -#endif - /* * End initialization functions. */ diff --git a/src/zone.c b/src/zone.c index 9fc87bb7..6c1e415b 100644 --- a/src/zone.c +++ b/src/zone.c @@ -166,6 +166,7 @@ zone_force_unlock(malloc_zone_t *zone) jemalloc_postfork_parent(); } +JEMALLOC_ATTR(constructor) void register_zone(void) {