Correct allocator block size after shrinking - #167
Open
stefanmaierhofer wants to merge 1 commit into
Open
Conversation
Update the surviving block size before freeing the nonzero shrink tail in both MemoryManager and ChunkedMemoryManager. This keeps Block.Size and Use ranges consistent with the storage returned to the free list, preventing overlapping reported live ranges while preserving offsets, alignment, prefix data, coalescing, and capacity trimming. Add shared CPU regressions for both allocators that exercise aligned offsets, reported and observed sizes, prefix preservation, immediate tail reuse, non-overlap, free-list coalescing, and capacity release/reuse. Fixes #166
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.
Summary
Block.Sizebefore releasing a nonzero shrink tail in bothMemoryManagerandChunkedMemoryManagerBlock.Sizeand the range passed toUseconsistent with storage returned to the free listCoverage
The new tests use aligned, guarded allocations and verify:
Useafter shrinkingOn
master, shrinking[0, 10)to five units leaves both allocator variants reporting[0, 10)throughBlock.SizeandUse, while a new allocation receives[5, 10). The ranges therefore overlap.The two focused regressions passed 100 consecutive Release runs (200 focused passes). A 50-test backend-independent maintained selection passed in both Debug and Release. The complete non-Windows solution builds cleanly in both configurations.
Performance
CPU-pinned warmed Release medians over ten alternating runs; each run used eleven no-GC samples of 50,000 independent shrink operations:
masterMemoryManagershrinkChunkedMemoryManagershrinkBoth paths remain allocation-identical and show no throughput regression.
Fixes #166.