Skip to content

Windows: the build's peak memory for a compile it runs is far too low (773 MB reported, 8 GB measured) #3456

Done

Description

@ehartford

Seen 2026-11-18 on the win10 VM, measuring #3364. src/main.exe build :dev printed [times] … slowest: stage1 209.6s; peak rss 773M (stage1). A sampler (Win32_Process every 3 s) identified the stage1 compile by its command line (main.exe build out/gen/main.w -O1 -o …with-stage1.exe.tmp) at 8,446 MB committed and 8,024 MB working set in the same run.

For a direct child the figure is right: a launcher using run_to_files_in reported peak_rss 3,855 MB for a compile the sampler saw at 3,772 MB.

Suspect. The build measures another process than the compile (a wrapper or runner between them), or reads the counters before the child's peak (win_process_peak_rss, rt/windows_x86_64.w, and its three callers at reap).

Why it matters. The build's per-target memory report is what its scheduling and its own reports rely on; on Windows it hid an 8 GB compile for as long as it existed.

Activity

  1. ehartford commented on Nov 19, 2026

    @ehartford
    ContributorAuthor

    Reading notes (2026-11-18, no VM). rt_compat_exec_child_maxrss is "the most recently reaped child" on every platform, and win_process_peak_rss reads PeakWorkingSetSize at the three reap sites (rt/windows_x86_64.w lines 1641, 1650, 1969). For a direct child it is right (a launcher over run_to_files_in reported 3,855 MB for a compile sampled at 3,772 MB). In the 8 GB run the compile's parent was pid 8348, not the driver the launcher started, so the figure the build printed belongs to whichever process the build's own wait reaped last for that target: either an intermediate process (the build runner) or a later, smaller child of the same action. To settle on the VM in the next planned batch: print the pid and command line the driver reaps for stage1, beside build_graph_rt_child_maxrss().

  2. ehartford commented on Nov 19, 2026

    @ehartford
    ContributorAuthor

    Waits on the same planned Windows VM batch as #3364 (Eric's go).

  3. ehartford commented on Nov 19, 2026

    @ehartford
    ContributorAuthor

    Settled in the same batch (2026-11-19): in build :dev the driver was pid 7680 and the stage1 compile was pid 2304 with parent 7280. An intermediate process sits between them, so the process the driver reaps and measures is that one, not the compile: 773 MB reported for a compile at 8.5 GB. rt_compat_exec_child_maxrss is right for a direct child (a launcher's figure matched the sampler's within 3%). The fix is in what the build measures: the peak of the process tree under the reaped child (a job object's peak on Windows), not the child alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions