exposes macOs malloc_good_size (#538)
This commit is contained in:
@@ -61,6 +61,12 @@ extern "C"
|
|||||||
return ThreadAlloc::get().alloc_size(ptr);
|
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)
|
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(realloc)(void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
auto& a = ThreadAlloc::get();
|
auto& a = ThreadAlloc::get();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void check_result(size_t size, size_t align, void* p, int err, bool null)
|
|||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
const auto alloc_size = our_malloc_usable_size(p);
|
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
|
#ifdef SNMALLOC_PASS_THROUGH
|
||||||
// Calling system allocator may allocate a larger block than
|
// Calling system allocator may allocate a larger block than
|
||||||
// snmalloc. Note, we have called the system allocator with
|
// snmalloc. Note, we have called the system allocator with
|
||||||
|
|||||||
Reference in New Issue
Block a user