Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exposes macOs malloc_good_size #538

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/snmalloc/override/malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/test/func/malloc/malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down