Replace internal memory calls with non-standard jemalloc API

The jemalloc non-standard API fits nicely with our memory contexts, so
just rewrite the memory context internals to use the non-public API.

There's just one caveat - since we no longer track the size of the
allocation for isc_mem_allocate/isc_mem_free combination, we need to use
sallocx() to get real allocation size in both allocator and deallocator
because otherwise the sizes would not match.
This commit is contained in:
Ondřej Surý
2021-05-11 14:00:12 +02:00
parent 4b3d0c6600
commit fcc6814776
2 changed files with 75 additions and 102 deletions

View File

@@ -181,8 +181,7 @@ isc_mem_total_test(void **state) {
after = isc_mem_total(mctx2);
diff = after - before;
/* 2048 +8 bytes extra for size_info */
assert_int_equal(diff, (2048 + 8) * 100000);
assert_int_equal(diff, (2048) * 100000);
/* ISC_MEMFLAG_INTERNAL */
@@ -198,8 +197,7 @@ isc_mem_total_test(void **state) {
after = isc_mem_total(test_mctx);
diff = after - before;
/* 2048 +8 bytes extra for size_info */
assert_int_equal(diff, (2048 + 8) * 100000);
assert_int_equal(diff, (2048) * 100000);
isc_mem_destroy(&mctx2);
}