refactor(allocator/fixed-size): store alloc_ptr in the memory block backing the allocator#12380
Merged
graphite-app[bot] merged 1 commit intomainfrom Jul 18, 2025
Conversation
Member
Author
This was referenced Jul 18, 2025
CodSpeed Instrumentation Performance ReportMerging #12380 will not alter performanceComparing Summary
|
e085e9e to
5aabc52
Compare
2750a9a to
6524307
Compare
This was referenced Jul 18, 2025
Contributor
Merge activity
|
… backing the allocator (#12380) `FixedSizeAllocator`s allocate a block of memory larger than what the `Allocator` controls, and often with a different start pointer. So when `FixedSizeAllocator` is dropped, it needs to deallocate that block of memory using the original pointer. That pointer way previously stored in `FixedSizeAllocator` itself. Instead store it in a `FixedSizeAllocatorMetadata` struct, which is written into the memory block itself, after the section controlled by the `Allocator`, and other metadata (`RawTransferMetadata`). This allows getting the original `alloc_ptr` when you only have access to the `Allocator`, but not the `FixedSizeAllocator`.
5aabc52 to
8fe1aec
Compare
6524307 to
319fc3b
Compare
Base automatically changed from
07-17-refactor_ast_tools_allocator_napi_parser_rename_vars
to
main
July 18, 2025 09:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

FixedSizeAllocators allocate a block of memory larger than what theAllocatorcontrols, and often with a different start pointer. So whenFixedSizeAllocatoris dropped, it needs to deallocate that block of memory using the original pointer.That pointer was previously stored in
FixedSizeAllocatoritself. Instead store it in aFixedSizeAllocatorMetadatastruct, which is written into the memory block itself, after the section controlled by theAllocator, and other metadata (RawTransferMetadata).This allows getting the original
alloc_ptrwhen you only have access to theAllocator, but not theFixedSizeAllocator.