diff options
| author | Qi Wang <interwq@gwu.edu> | 2017-03-30 00:00:52 (GMT) |
|---|---|---|
| committer | Qi Wang <interwq@gmail.com> | 2017-04-04 07:34:49 (GMT) |
| commit | d3cda3423cd7ae47630833e4a888bdaf6a7bf8d9 (patch) | |
| tree | 2d2d1200ae1c7a84201fed491bb9477d5c46339a /src | |
| parent | 51d368295032910577d4f34b9ff99b3ed41544b9 (diff) | |
| download | jemalloc-d3cda3423cd7ae47630833e4a888bdaf6a7bf8d9.zip jemalloc-d3cda3423cd7ae47630833e4a888bdaf6a7bf8d9.tar.gz jemalloc-d3cda3423cd7ae47630833e4a888bdaf6a7bf8d9.tar.bz2 | |
Do proper cleanup for tsd_state_reincarnated.
Also enable arena_bind under non-nominal state, as the cleanup will be handled
correctly now.
Diffstat (limited to 'src')
| -rw-r--r-- | src/jemalloc.c | 9 | ||||
| -rw-r--r-- | src/tsd.c | 15 |
2 files changed, 8 insertions, 16 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c index ab047c2..7c8fe9c 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -422,13 +422,7 @@ arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { static void 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_t *arena = arena_get(tsd_tsdn(tsd), ind, false); arena_nthreads_inc(arena, internal); if (internal) { @@ -455,6 +449,7 @@ arena_unbind(tsd_t *tsd, unsigned ind, bool internal) { arena = arena_get(tsd_tsdn(tsd), ind, false); arena_nthreads_dec(arena, internal); + if (internal) { tsd_iarena_set(tsd, NULL); } else { @@ -86,6 +86,12 @@ tsd_cleanup(void *arg) { /* Do nothing. */ break; case tsd_state_nominal: + case tsd_state_reincarnated: + /* + * Reincarnated means another destructor deallocated memory + * after this destructor was called. Reset state to + * tsd_state_purgatory and request another callback. + */ #define MALLOC_TSD_cleanup_yes(n, t) \ n##_cleanup(tsd); #define MALLOC_TSD_cleanup_no(n, t) @@ -106,15 +112,6 @@ MALLOC_TSD * nothing, and do not request another callback. */ break; - case tsd_state_reincarnated: - /* - * Another destructor deallocated memory after this destructor - * was called. Reset state to tsd_state_purgatory and request - * another callback. - */ - tsd->state = tsd_state_purgatory; - tsd_set(tsd); - break; default: not_reached(); } |
