diff options
author | Qi Wang <interwq@gwu.edu> | 2017-03-28 04:50:38 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2017-04-07 16:55:14 (GMT) |
commit | fde3e20cc04db459f3c76134bc6dfb0ee5c422bb (patch) | |
tree | c5dd961498e734f52f02c40159ce0d8a52bb0af6 /test | |
parent | eeabdd246693fbf7c54e03ff8957889e63dc9a0c (diff) | |
download | jemalloc-fde3e20cc04db459f3c76134bc6dfb0ee5c422bb.zip jemalloc-fde3e20cc04db459f3c76134bc6dfb0ee5c422bb.tar.gz jemalloc-fde3e20cc04db459f3c76134bc6dfb0ee5c422bb.tar.bz2 |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tsd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/unit/tsd.c b/test/unit/tsd.c index e033bb7..5bfcdf4 100644 --- a/test/unit/tsd.c +++ b/test/unit/tsd.c @@ -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, |