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

Clean up get_maximum_aligned_size #726

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

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Jan 4, 2023

This PR fixes #730.

  • Alignment offset is now usize rather than isize. We never allow negative values, and it was a mistake to use isize.
  • Seperate alignment padding calculation from align_alloc and get_maximum_aligned_size, update the implementation and add unit tests.
  • get_maximum_aligned_size also requires offset to work properly.
    • The mimalloc allocator (FreeListAllocator) is updated. As we would need to pass around both align and offset, we simply calculate bin once, and pass it around instead.
  • Default value as known_alignment should be VM::ALLOC_END_ALIGNMENT rather than MIN_ALIGNMENT.

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.

Incorrect align_allocate and get_maximum_aligned_size
1 participant