[PATCH] Move last bit of zone initialization in zone.c, and lazy-initialize

Mike Hommey mh+jemalloc at glandium.org
Mon Apr 2 00:04:54 PDT 2012


From: Mike Hommey <mh at glandium.org>

---
 include/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 b7b8df8..f6924a4 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 {
@@ -402,9 +396,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
@@ -567,9 +558,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 9eb4252..0000000
--- 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 c0fe6c9..23541ae 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 9fc87bb..6c1e415 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)
 {
-- 
1.7.9.5




More information about the jemalloc-discuss mailing list