Skip to content

Clean up get_maximum_aligned_size#726

Draft
qinsoon wants to merge 8 commits intommtk:masterfrom
qinsoon:fix-get-maximum-aligned-size
Draft

Clean up get_maximum_aligned_size#726
qinsoon wants to merge 8 commits intommtk:masterfrom
qinsoon:fix-get-maximum-aligned-size

Conversation

@qinsoon
Copy link
Copy Markdown
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