diff options
author | Jason Evans <jasone@canonware.com> | 2014-01-22 11:11:22 -0800 |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2014-01-22 11:11:22 -0800 |
commit | cc47dde16203a6ae7eb685b53e1ae501f3869bc6 (patch) | |
tree | 74e81d65651b2ca7e294a857797dda6635177454 /src/tcache.c | |
parent | 0135fb806e4137dc9cdf152541926a2bc95e33f0 (diff) | |
parent | 798a48103014aabf8afb3d7efff90399a466dd8c (diff) | |
download | jemalloc-3.5.0.tar.gz |
Merge branch 'dev'3.5.0
Diffstat (limited to 'src/tcache.c')
-rw-r--r-- | src/tcache.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tcache.c b/src/tcache.c index 98ed19ed..6de92960 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -260,8 +260,8 @@ tcache_arena_dissociate(tcache_t *tcache) /* Unlink from list of extant tcaches. */ malloc_mutex_lock(&tcache->arena->lock); ql_remove(&tcache->arena->tcache_ql, tcache, link); - malloc_mutex_unlock(&tcache->arena->lock); tcache_stats_merge(tcache, tcache->arena); + malloc_mutex_unlock(&tcache->arena->lock); } } @@ -292,7 +292,7 @@ tcache_create(arena_t *arena) else if (size <= tcache_maxclass) tcache = (tcache_t *)arena_malloc_large(arena, size, true); else - tcache = (tcache_t *)icallocx(size, false, arena); + tcache = (tcache_t *)icalloct(size, false, arena); if (tcache == NULL) return (NULL); @@ -366,7 +366,7 @@ tcache_destroy(tcache_t *tcache) arena_dalloc_large(arena, chunk, tcache); } else - idallocx(tcache, false); + idalloct(tcache, false); } void @@ -399,11 +399,14 @@ tcache_thread_cleanup(void *arg) } } +/* Caller must own arena->lock. */ void tcache_stats_merge(tcache_t *tcache, arena_t *arena) { unsigned i; + cassert(config_stats); + /* Merge and reset tcache stats. */ for (i = 0; i < NBINS; i++) { arena_bin_t *bin = &arena->bins[i]; |