refactor(allocator): add Allocator::new_fixed_size method#22084
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
Refactors fixed-size allocator creation by introducing Allocator::new_fixed_size and Arena::new_fixed_size, moving the backing-allocation logic out of FixedSizeAllocatorPool and into the core allocator implementation to support future safety/platform work.
Changes:
- Add
Allocator::new_fixed_sizeandArena::new_fixed_size(feature/target gated). - Move the fixed-size backing allocation + alignment workaround into
crates/oxc_allocator/src/arena/fixed_size.rs. - Update
FixedSizeAllocatorPoolto construct fixed-size allocators via the new API.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_allocator/src/pool/fixed_size.rs | Switch pool allocator creation to Allocator::new_fixed_size and adjust chunk pointer derivation. |
| crates/oxc_allocator/src/lib.rs | Add feature/target-gated fixed_size module. |
| crates/oxc_allocator/src/fixed_size.rs | Introduce Allocator::new_fixed_size API. |
| crates/oxc_allocator/src/arena/mod.rs | Add feature/target-gated arena fixed_size module. |
| crates/oxc_allocator/src/arena/fixed_size.rs | Implement Arena::new_fixed_size and relocate the large-alignment allocation workaround. |
Merge activity
|
Add a method `new_fixed_size` to `Arena` and `Allocator`. This moves logic for creating fixed-size allocators out of `FixedSizeAllocatorPool` and into core `Arena` implementation. This is starting point for making fixed-size allocators safer, managing their own memory, and having platform-specific behavior for creation and drop (moving towards fixing the Windows OOM bug in Oxlint and `napi/parser` raw transfer).
1638b41 to
6de10fc
Compare

Add a method
new_fixed_sizetoArenaandAllocator. This moves logic for creating fixed-size allocators out ofFixedSizeAllocatorPooland into coreArenaimplementation.This is starting point for making fixed-size allocators safer, managing their own memory, and having platform-specific behavior for creation and drop (moving towards fixing the Windows OOM bug in Oxlint and
napi/parserraw transfer).