Skip to content

refactor(allocator/fixed-size): store alloc_ptr in the memory block backing the allocator#12380

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-17-refactor_allocator_fixed-size_store_alloc_ptr_in_the_memory_block_backing_the_allocator
Jul 18, 2025
Merged

refactor(allocator/fixed-size): store alloc_ptr in the memory block backing the allocator#12380
graphite-app[bot] merged 1 commit intomainfrom
07-17-refactor_allocator_fixed-size_store_alloc_ptr_in_the_memory_block_backing_the_allocator

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 18, 2025

FixedSizeAllocators 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 was 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.

@github-actions github-actions bot added A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jul 18, 2025
Copy link
Member Author

overlookmotel commented Jul 18, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 18, 2025

CodSpeed Instrumentation Performance Report

Merging #12380 will not alter performance

Comparing 07-17-refactor_allocator_fixed-size_store_alloc_ptr_in_the_memory_block_backing_the_allocator (319fc3b) with main (de006a1)

Summary

✅ 34 untouched benchmarks

Copy link
Contributor

camc314 commented Jul 18, 2025

Merge activity

@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 18, 2025
… 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`.
@graphite-app graphite-app bot force-pushed the 07-17-refactor_ast_tools_allocator_napi_parser_rename_vars branch from 5aabc52 to 8fe1aec Compare July 18, 2025 08:59
@graphite-app graphite-app bot requested a review from camc314 as a code owner July 18, 2025 08:59
@graphite-app graphite-app bot force-pushed the 07-17-refactor_allocator_fixed-size_store_alloc_ptr_in_the_memory_block_backing_the_allocator branch from 6524307 to 319fc3b Compare July 18, 2025 09:00
Base automatically changed from 07-17-refactor_ast_tools_allocator_napi_parser_rename_vars to main July 18, 2025 09:07
@graphite-app graphite-app bot merged commit 319fc3b into main Jul 18, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 07-17-refactor_allocator_fixed-size_store_alloc_ptr_in_the_memory_block_backing_the_allocator branch July 18, 2025 09:10
graphite-app bot pushed a commit that referenced this pull request Jul 21, 2025
…ocator` (#12426)

Pure refactor. #12380 removed the `NonNull<u8>` from `FixedSizeAllocator`, so `FixedSizeAllocator` is now automatically `Send`. Remove redundant manual `Send` impl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants