diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
| commit | dcacc00e3750300617ba6e16eb346713f91a783a (patch) | |
| tree | 38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c | |
| parent | 58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff) | |
| download | crep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz | |
Remove testing data
Diffstat (limited to 'examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c')
| -rw-r--r-- | examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c b/examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c deleted file mode 100644 index baed86c..0000000 --- a/examples/redis-unstable/deps/jemalloc/test/unit/zero_realloc_free.c +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | #include "test/jemalloc_test.h" | ||
| 2 | |||
| 3 | static uint64_t | ||
| 4 | deallocated() { | ||
| 5 | if (!config_stats) { | ||
| 6 | return 0; | ||
| 7 | } | ||
| 8 | uint64_t deallocated; | ||
| 9 | size_t sz = sizeof(deallocated); | ||
| 10 | expect_d_eq(mallctl("thread.deallocated", (void *)&deallocated, &sz, | ||
| 11 | NULL, 0), 0, "Unexpected mallctl failure"); | ||
| 12 | return deallocated; | ||
| 13 | } | ||
| 14 | |||
| 15 | TEST_BEGIN(test_realloc_free) { | ||
| 16 | void *ptr = mallocx(42, 0); | ||
| 17 | expect_ptr_not_null(ptr, "Unexpected mallocx error"); | ||
| 18 | uint64_t deallocated_before = deallocated(); | ||
| 19 | ptr = realloc(ptr, 0); | ||
| 20 | uint64_t deallocated_after = deallocated(); | ||
| 21 | expect_ptr_null(ptr, "Realloc didn't free"); | ||
| 22 | if (config_stats) { | ||
| 23 | expect_u64_gt(deallocated_after, deallocated_before, | ||
| 24 | "Realloc didn't free"); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | TEST_END | ||
| 28 | |||
| 29 | int | ||
| 30 | main(void) { | ||
| 31 | return test( | ||
| 32 | test_realloc_free); | ||
| 33 | } | ||
