aboutsummaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2016-09-22 09:13:45 -0700
committerJason Evans <jasone@canonware.com>2016-09-22 09:13:45 -0700
commit1cb399b630db16892069cb37b6b0853ca318bb77 (patch)
treeb2dd2b1eefcb7a96ba452e1259de9481da5b4ef0 /src/jemalloc.c
parent17c4b8de5f4ef2732dfa83cbc86e2cf112f48635 (diff)
downloadplatform_external_jemalloc_new-1cb399b630db16892069cb37b6b0853ca318bb77.tar.gz
platform_external_jemalloc_new-1cb399b630db16892069cb37b6b0853ca318bb77.tar.bz2
platform_external_jemalloc_new-1cb399b630db16892069cb37b6b0853ca318bb77.zip
Fix arena_bind().
When tsd is not in nominal state (e.g. during thread termination), we should not increment nthreads.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 10074013..24158552 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -442,15 +442,16 @@ arena_bind(tsd_t *tsd, unsigned ind, bool internal)
{
arena_t *arena;
+ if (!tsd_nominal(tsd))
+ return;
+
arena = arena_get(tsd_tsdn(tsd), ind, false);
arena_nthreads_inc(arena, internal);
- if (tsd_nominal(tsd)) {
- if (internal)
- tsd_iarena_set(tsd, arena);
- else
- tsd_arena_set(tsd, arena);
- }
+ if (internal)
+ tsd_iarena_set(tsd, arena);
+ else
+ tsd_arena_set(tsd, arena);
}
void