refactor(allocator): improve safety of dealloc_chunk_list#21779
Merged
graphite-app[bot] merged 1 commit intoApr 26, 2026
Merged
Conversation
This was referenced Apr 26, 2026
Merged
Member
Author
This was referenced Apr 26, 2026
Merging this PR will not alter performance
Comparing Footnotes
|
overlookmotel
force-pushed
the
om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_chunk_iterators
branch
from
April 26, 2026 12:27
67ff1f2 to
a82c143
Compare
overlookmotel
force-pushed
the
om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_
branch
from
April 26, 2026 12:27
8f6d4d9 to
a44ec68
Compare
overlookmotel
marked this pull request as ready for review
April 26, 2026 18:46
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Arena’s chunk deallocation helper to make aliasing/lifetime boundaries around ChunkFooter references explicit, reduce the scope of unsafe blocks, and document the safety assumptions involved in freeing arena chunks.
Changes:
- Refactors
dealloc_chunk_listto ensure&ChunkFooterborrows are not live acrossdealloc. - Narrows
unsafeblocks to only the operations that require them. - Adds safety documentation/comments explaining required invariants.
overlookmotel
changed the base branch from
om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_chunk_iterators
to
graphite-base/21779
April 26, 2026 20:47
overlookmotel
force-pushed
the
graphite-base/21779
branch
from
April 26, 2026 20:48
a82c143 to
1d77796
Compare
overlookmotel
force-pushed
the
om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_
branch
from
April 26, 2026 20:48
a44ec68 to
e689974
Compare
overlookmotel
changed the base branch from
graphite-base/21779
to
om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_chunk_iterators
April 26, 2026 20:48
This was referenced Apr 26, 2026
overlookmotel
force-pushed
the
om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_
branch
from
April 26, 2026 21:15
e689974 to
75bb873
Compare
Contributor
Merge activity
|
Improve the safety of `Arena`'s `dealloc_chunk_list` function:
- Ensure `&ChunkFooter` reference is not live when the chunk containing that `ChunkFooter` is deallocated.
- Scope `unsafe { ... }` blocks to cover just the statements that require them.
- Document the safety invariants.
I don't believe there was a soundness issue here (as `&ChunkFooter` references were short-lived), but this change makes the importance of avoiding live references clear, and explicitly guards against it.
graphite-app
Bot
force-pushed
the
om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_chunk_iterators
branch
from
April 26, 2026 21:52
1d77796 to
6889c46
Compare
graphite-app
Bot
force-pushed
the
om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_
branch
from
April 26, 2026 21:53
75bb873 to
5e7dbac
Compare
Base automatically changed from
om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_chunk_iterators
to
main
April 26, 2026 22:09
graphite-app
Bot
deleted the
om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_
branch
April 26, 2026 22:10
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.

Improve the safety of
Arena'sdealloc_chunk_listfunction:&ChunkFooterreference is not live when the chunk containing thatChunkFooteris deallocated.unsafe { ... }blocks to cover just the statements that require them.I don't believe there was a soundness issue here (as
&ChunkFooterreferences were short-lived), but this change makes the importance of avoiding live references clear, and explicitly guards against it.