[PATCH 08/11] Initialize all members of non-TLS tsd wrapper when creating it

Mike Hommey mh+jemalloc at glandium.org
Wed Apr 18 09:29:47 PDT 2012


From: Mike Hommey <mh at glandium.org>

Not setting the initialized member leads to randomly calling the cleanup
function in cases it shouldn't be called (and isn't called in other
implementations).
---
 include/jemalloc/internal/tsd.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h
index aee37b1..d1dd3d0 100644
--- a/include/jemalloc/internal/tsd.h
+++ b/include/jemalloc/internal/tsd.h
@@ -253,6 +253,7 @@ a_name##_tsd_get_wrapper(void)						\
 		} else {						\
 			static a_type tsd_static_data = a_initializer;	\
 			wrapper->isstatic = false;			\
+			wrapper->initialized = false;			\
 			wrapper->val = tsd_static_data;			\
 		}							\
 		if (pthread_setspecific(a_name##_tsd,			\
-- 
1.7.10




More information about the jemalloc-discuss mailing list