Repository navigation
[gc-stats][windows] Exclude the runtime events ring from max RSS on Windows - #154
Open
ngorogiannis wants to merge 1 commit into
Open
ngorogiannis wants to merge 1 commit into
ngorogiannis wants to merge 1 commit into
Conversation
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
from
September 23, 2026 07:25
9c135f3 to
6768ae3
Compare
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
from
September 30, 2026 07:53
6768ae3 to
56767ff
Compare
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
from
September 30, 2026 07:54
56767ff to
6768ae3
Compare
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
from
September 30, 2026 07:55
6768ae3 to
99600ce
Compare
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
3 times, most recently
from
November 10, 2026 18:27
1295903 to
91b7c0d
Compare
ngorogiannis
marked this pull request as draft
November 11, 2026 08:03
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
6 times, most recently
from
November 13, 2026 17:27
c3b4a62 to
cabbb5d
Compare
…indows The Windows arm of the exclusion the previous two commits added for Linux and macOS. The ring's mapping is found by walking the child's regions with VirtualQueryEx and asking GetMappedFileNameW which file backs each mapped one. A region carries no file identity here, only a name, so both sides are resolved through an open handle: the ring file's NT path comes from GetFinalPathNameByHandleW with VOLUME_NAME_NT, which is the namespace GetMappedFileNameW answers in. The extent then comes from the allocation base the view's regions share, since VirtualProtect can split one MapViewOfFile across several. The mapping never moves, so its range is cached. Its resident share is counted with QueryWorkingSet, keeping the entries that fall in that range. As on Linux those are the child's own pages, the same ones GetProcessMemoryInfo returns the size of, so the ring's pages are a subset of the working set by construction and the subtraction is exact. Windows reports WorkingSetSize and the poller takes the peak of the difference, falling back to the kernel's exact PeakWorkingSetSize when the ring cannot be attributed. Unlike the other platforms the sample has to be discarded explicitly once the child is gone. With its handle still open GetProcessMemoryInfo keeps answering, returning the peak the ring was part of, while everything that reads the address space starts failing, so that pair would be recorded as a peak with the ring left in and would mark the whole run as not having excluded it. GetExitCodeProcess is checked after the numbers are read rather than before, since before it is exactly the window that leaves open. The path the FFI entry copies is no longer bounded by PATH_MAX, which is 260 on Windows and which a temp directory can exceed now that long paths are supported.
ngorogiannis
force-pushed
the
win-rss-without-ring
branch
from
November 17, 2026 17:16
cabbb5d to
e83ec71
Compare
ngorogiannis
marked this pull request as ready for review
November 18, 2026 15: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.
The Windows arm of the exclusion the previous two commits added for
Linux and macOS.
The ring's mapping is found by walking the child's regions with
VirtualQueryEx and asking GetMappedFileNameW which file backs each
mapped one. A region carries no file identity here, only a name, so both
sides are resolved through an open handle:
the ring file's NT path comes from GetFinalPathNameByHandleW
with VOLUME_NAME_NT, which is the namespace GetMappedFileNameW answers
in. The extent then comes from the allocation base the view's regions
share, since VirtualProtect can split one MapViewOfFile across several.
The mapping never moves, so its range is cached.
Its resident share is counted with QueryWorkingSet, keeping the entries
that fall in that range. As on Linux those are the child's own pages,
the same ones GetProcessMemoryInfo returns the size of, so the ring's
pages are a subset of the working set by construction and the
subtraction is exact.
Windows reports WorkingSetSize and the poller takes the peak of the
difference, falling back to the kernel's exact PeakWorkingSetSize when
the ring cannot be attributed.
Unlike the other platforms the sample has to be discarded explicitly
once the child is gone. With its handle still open GetProcessMemoryInfo
keeps answering, returning the peak the ring was part of, while
everything that reads the address space starts failing, so that pair
would be recorded as a peak with the ring left in and would mark the
whole run as not having excluded it. GetExitCodeProcess is checked after
the numbers are read rather than before, since before it is exactly the
window that leaves open.
The path the FFI entry copies is no longer bounded by PATH_MAX, which is
260 on Windows and which a temp directory can exceed now that long paths
are supported.
Stack created with GitHub Stacks CLI • Give Feedback 💬