summaryrefslogtreecommitdiffstats
path: root/jemalloc/src/jemalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'jemalloc/src/jemalloc.c')
-rw-r--r--jemalloc/src/jemalloc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c
index f5434c7..61a36c7 100644
--- a/jemalloc/src/jemalloc.c
+++ b/jemalloc/src/jemalloc.c
@@ -213,6 +213,28 @@ stats_print_atexit(void)
JEMALLOC_P(malloc_stats_print)(NULL, NULL, NULL);
}
+#if (defined(JEMALLOC_STATS) && defined(NO_TLS))
+thread_allocated_t *
+thread_allocated_get_hard(void)
+{
+ thread_allocated_t *thread_allocated = (thread_allocated_t *)
+ imalloc(sizeof(thread_allocated_t));
+ if (thread_allocated == NULL) {
+ static thread_allocated_t static_thread_allocated = {0, 0};
+ malloc_write("<jemalloc>: Error allocating TSD;"
+ " mallctl(\"thread.{de,}allocated[p]\", ...)"
+ " will be inaccurate\n");
+ if (opt_abort)
+ abort();
+ return (&static_thread_allocated);
+ }
+ pthread_setspecific(thread_allocated_tsd, thread_allocated);
+ thread_allocated->allocated = 0;
+ thread_allocated->deallocated = 0;
+ return (thread_allocated);
+}
+#endif
+
/*
* End miscellaneous support functions.
*/