Commit 06f0502
Test deterministic cleanup on last-reader drain; refresh stale comments
Add two MMapDirectory tests for the determinism guarantee against real mapped
memory, using only the existing zero-cost SetOnEnterForTest seam (a null-check
already on the hot path - no new production overhead):
- TestCloseWhileCloneReadingDefersUnmapThenReleasesOnDrain: the owner is disposed
WHILE a clone is parked mid-read; the chunks must stay mapped (deferred), then
unmap the instant that last reader drains - with no GC/finalizer step. This is
the close-while-reading ordering the existing tests didn't cover.
- TestLastSliceFinishedThenSlicerDisposeUnmapsDeterministically: a slice reads to
completion (drained), then the slicer is disposed -> every chunk and the
FileStream are unmapped synchronously.
Also sweep the MMap tests + comments inherited from the mmap-redesign branch that
described the old per-chunk-crossing read-reference / SafeHandle-refcount drain /
"shared View" / TryEnterRead / "chunk rent" model, which no longer exists on this
branch, and rephrase them for the DrainReclaimer design. Comment-only; behavior
and assertions unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6ac506f commit 06f0502
2 files changed
Lines changed: 187 additions & 94 deletions
0 commit comments