Skip to content

small: improve real_size calculation in small_alloc_info #108

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Gumix
Copy link
Contributor

@Gumix Gumix commented Jun 5, 2025

Currently real_size is calculated as the size of a memory block that would be allocated for the requested number of bytes. However, this calculation is non-idempotent. For details see commit df7ba1f ("small: implement new allocator strategy").

This patch switches small_alloc_info() to slab_from_ptr() that returns the actual slab that contains the requested ptr, so now real_size is always correct.

Needed for tarantool/tarantool#10217

Gumix added 2 commits June 5, 2025 17:37
This patch removes the following ancient declarations:
 - `size_t small_ptr_compress();`
 - `void *small_ptr_decompress();`
Currently `real_size` is calculated as the size of a memory block that
would be allocated for the requested number of bytes. However, this
calculation is non-idempotent. For details see commit df7ba1f
("small: implement new allocator strategy").

This patch switches `small_alloc_info()` to `slab_from_ptr()` that
returns the actual slab that contains the requested `ptr`, so now
`real_size` is always correct.

Needed for tarantool/tarantool#10217
@Gumix Gumix marked this pull request as draft June 5, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant