mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-24 03:42:14 +03:00
Integrate auto tcache into TSD.
The embedded tcache is initialized upon tsd initialization. The avail arrays for the tbins will be allocated / deallocated accordingly during init / cleanup. With this change, the pointer to the auto tcache will always be available, as long as we have access to the TSD. tcache_available() (called in tcache_get()) is provided to check if we should use tcache.
This commit is contained in:
parent
eeabdd2466
commit
fde3e20cc0
16 changed files with 300 additions and 178 deletions
|
|
@ -5,6 +5,7 @@
|
|||
typedef unsigned int data_t;
|
||||
|
||||
static bool data_cleanup_executed;
|
||||
static bool data_test_started;
|
||||
|
||||
malloc_tsd_types(data_, data_t)
|
||||
malloc_tsd_protos(, data_, data_t)
|
||||
|
|
@ -13,6 +14,9 @@ void
|
|||
data_cleanup(void *arg) {
|
||||
data_t *data = (data_t *)arg;
|
||||
|
||||
if (!data_test_started) {
|
||||
return;
|
||||
}
|
||||
if (!data_cleanup_executed) {
|
||||
assert_x_eq(*data, THREAD_DATA,
|
||||
"Argument passed into cleanup function should match tsd "
|
||||
|
|
@ -135,7 +139,9 @@ main(void) {
|
|||
malloc_printf("Initialization error");
|
||||
return test_status_fail;
|
||||
}
|
||||
data_test_started = false;
|
||||
data_tsd_boot();
|
||||
data_test_started = true;
|
||||
|
||||
return test(
|
||||
test_tsd_main_thread,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue