Fix arenas_cache_cleanup().

Fix arenas_cache_cleanup() to handle allocation/deallocation within the
application's thread-specific data cleanup functions even after
arenas_cache is torn down.
This commit is contained in:
Christopher Ferris 2015-08-21 12:23:06 -07:00 committed by Jason Evans
parent b5c2a347d7
commit 45e9f66c28
3 changed files with 15 additions and 2 deletions

View File

@ -4,9 +4,12 @@ brevity. Much more detail can be found in the git revision history:
https://github.com/jemalloc/jemalloc https://github.com/jemalloc/jemalloc
* 4.x.x (XXX) * 4.0.1 (XXX)
Bug fixes: Bug fixes:
- Fix arenas_cache_cleanup() to handle allocation/deallocation within the
application's thread-specific data cleanup functions even after
arenas_cache is torn down.
- Don't bitshift by negative amounts when encoding/decoding run sizes in chunk - Don't bitshift by negative amounts when encoding/decoding run sizes in chunk
header maps. This affected systems with page sizes greater than 8 KiB. header maps. This affected systems with page sizes greater than 8 KiB.
- Rename index_t to szind_t to avoid an existing type on Solaris. - Rename index_t to szind_t to avoid an existing type on Solaris.

View File

@ -649,8 +649,12 @@ arenas_cache_cleanup(tsd_t *tsd)
arena_t **arenas_cache; arena_t **arenas_cache;
arenas_cache = tsd_arenas_cache_get(tsd); arenas_cache = tsd_arenas_cache_get(tsd);
if (arenas_cache != NULL) if (arenas_cache != NULL) {
bool *arenas_cache_bypassp = tsd_arenas_cache_bypassp_get(tsd);
*arenas_cache_bypassp = true;
tsd_arenas_cache_set(tsd, NULL);
a0dalloc(arenas_cache); a0dalloc(arenas_cache);
}
} }
void void

View File

@ -56,9 +56,14 @@ static void *
thd_start(void *arg) thd_start(void *arg)
{ {
data_t d = (data_t)(uintptr_t)arg; data_t d = (data_t)(uintptr_t)arg;
void *p;
assert_x_eq(*data_tsd_get(), DATA_INIT, assert_x_eq(*data_tsd_get(), DATA_INIT,
"Initial tsd get should return initialization value"); "Initial tsd get should return initialization value");
p = malloc(1);
assert_ptr_not_null(p, "Unexpected malloc() failure");
data_tsd_set(&d); data_tsd_set(&d);
assert_x_eq(*data_tsd_get(), d, assert_x_eq(*data_tsd_get(), d,
"After tsd set, tsd get should return value that was set"); "After tsd set, tsd get should return value that was set");
@ -67,6 +72,7 @@ thd_start(void *arg)
assert_x_eq(*data_tsd_get(), (data_t)(uintptr_t)arg, assert_x_eq(*data_tsd_get(), (data_t)(uintptr_t)arg,
"Resetting local data should have no effect on tsd"); "Resetting local data should have no effect on tsd");
free(p);
return (NULL); return (NULL);
} }