summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2021-10-19 17:14:08 -0700
committerQi Wang <interwq@gmail.com>2021-10-28 10:05:59 -0700
commit4d56aaeca5883ae5f4b5550c528503fb51fdf479 (patch)
tree15efd096e56c2241354c8246061a335afbbc03aa /test
parent26f5257b88c925357bc524444a61049905e7bd19 (diff)
downloadjemalloc-4d56aaeca5883ae5f4b5550c528503fb51fdf479.tar.gz
Optimize away the tsd_fast() check on free fastpath.
To ensure that the free fastpath can tolerate uninitialized tsd, improved the static initializer for rtree_ctx in tsd.
Diffstat (limited to 'test')
-rw-r--r--test/unit/tsd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/tsd.c b/test/unit/tsd.c
index 3f3ca73d..205d8708 100644
--- a/test/unit/tsd.c
+++ b/test/unit/tsd.c
@@ -48,6 +48,13 @@ thd_start(void *arg) {
int d = (int)(uintptr_t)arg;
void *p;
+ /*
+ * Test free before tsd init -- the free fast path (which does not
+ * explicitly check for NULL) has to tolerate this case, and fall back
+ * to free_default.
+ */
+ free(NULL);
+
tsd_t *tsd = tsd_fetch();
expect_x_eq(tsd_test_data_get(tsd), MALLOC_TSD_TEST_DATA_INIT,
"Initial tsd get should return initialization value");