test: make the allocation guard stable across platforms (#136) - #238
Merged
Conversation
The cross-platform differential (#128) caught ExtractAsync_does_not_allocate_ per_item failing on linux-x64 while passing on linux-arm64 and windows-x64. GC.GetTotalAllocatedBytes is process-wide, so background allocation landing in a measurement window could exceed the 4 B/item budget on a shared runner. Hardened: settle GC/finalizers before each measurement, raise the marginal denominator (BaseCount 20k -> 50k, so 450k marginal items amortize a stray 1 MB spike to ~2.3 B/item), take the min of 5 attempts instead of 3, and raise the budget 4 -> 8 B/item — still an order of magnitude below a real per-item regression (boxing is ~24 B/item). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 29, 2026
This was referenced Aug 5, 2026
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.
Found by the cross-platform differential (#128) — it did exactly its job.
AllocationRegressionTests.ExtractAsync_does_not_allocate_per_item(my #136 test, merged in #227) was failing on linux-x64 while passing on linux-arm64 and windows-x64, which trippedDiff outcomes across platformson #228, #230 and #231.Root cause
GC.GetTotalAllocatedBytesis process-wide, so background allocation landing inside a measurement window inflates the reading. On a shared runner that could push the marginal figure past the 4 B/item budget — an environment-sensitive test, not a real regression.This matters beyond the differential: left as-is it would fail Stage 1 Linux tests on the eventual
vNext → mainrelease PR.Hardening
Verified locally: 5 consecutive runs, all green.
Note
#228/#230/#231 need this merged into vNext and pulled in before their differential goes green.
🤖 Generated with Claude Code