exposes macOs malloc_good_size (#538)

This commit is contained in:
David CARLIER
2022-06-07 16:09:55 +01:00
committed by GitHub
parent 392acff4d5
commit e7e558badf
2 changed files with 7 additions and 1 deletions

View File

@@ -61,6 +61,12 @@ extern "C"
return ThreadAlloc::get().alloc_size(ptr);
}
SNMALLOC_EXPORT
size_t SNMALLOC_NAME_MANGLE(malloc_good_size)(size_t size)
{
return round_size(size);
}
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(realloc)(void* ptr, size_t size)
{
auto& a = ThreadAlloc::get();

View File

@@ -32,7 +32,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null)
failed = true;
}
const auto alloc_size = our_malloc_usable_size(p);
auto expected_size = round_size(size);
auto expected_size = our_malloc_good_size(size);
#ifdef SNMALLOC_PASS_THROUGH
// Calling system allocator may allocate a larger block than
// snmalloc. Note, we have called the system allocator with