Repository navigation
Description
Follows #3652 (PR #3654, Windows RAM and job limits in lightcraft-sysmem), itself on #3072 (PR #3118, cgroup limits).
Summary
On Windows, cargo xtask ci sizes its build jobs and test threads without looking at the job object it runs in. Both of xtask's memory readings go through PowerShell, and neither sees a job memory limit:
- Available RAM (
available_ram_mb):Win32_PerfFormattedData_PerfOS_Memory.AvailableMBytes, the machine's free memory. CI uses this first to size its build jobs (ci_jobs: one per 1.5 GB). - Total RAM (
total_ram_gb):Win32_ComputerSystem.TotalPhysicalMemory, the installed RAM. CI falls back to half of this when available RAM can't be read, and the CI report records it asram_total_gb.
So a CI runner, container or sandbox that starts xtask in a job with a memory limit gets as many jobs as the whole machine would. For example, a 64 GB machine with 40 GB free and an 8 GB job limit gets 26 jobs (capped at the CPU count) instead of about 5. Allocations past the limit fail, so the build or the tests then die partway through. That is the out-of-memory failure #3072 fixed on Linux.
On Linux, #3118 already moved xtask to lightcraft_sysmem::effective_total() / available(). #3654 adds the Windows job limit to effective_total() and the new job_limit(), but leaves xtask on PowerShell. Its description lists this as a follow-up.
Evidence (fix/3652-windows-memory 609bff3)
xtask/src/ci.rs:26-27: on Windows,available_ram_mbrunspowershell … AvailableMBytes, which counts the whole machine.xtask/src/ci.rs:48-49: on Windows,total_ram_gbrunspowershell … (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory, which is also the whole machine.xtask/src/main.rs:134:available_ram_mb().or_else(|| total_ram_gb() … / 2)thenci_jobs(…). Neither reading is held to a job limit.
Proposed fix
- Total:
total_ram_gbuseslightcraft_sysmem::effective_total()on Windows as on Linux, which gives min(RAM, job limit). The PowerShell query for the total goes away. When nothing can be read, the result isNone, as today, and CI keeps its default of 4 jobs. - Available: sysmem has no Windows
available(), so xtask keeps PowerShell'sAvailableMBytesfor the machine's free memory. It holds that number to the job limit (job_limit()). This is an upper bound: Windows' job query here doesn't report how much the job already uses. - Tests: keep the decision logic in pure functions that are tested on every platform. Add a Windows-only test that
total_ram_gbmatcheseffective_total().
Activity
ticket-craft commentedon Nov 3, 2026
Possibly related: #3072 and #3652.
test(xtask): storytold#3705 CI's RAM fallback with available RAM unkn…
fix(xtask): storytold#3705 Windows CI sizing follows the job object's…
test(xtask): storytold#3705 CI's RAM fallback with available RAM unkn…
Issue storytold#3705: ci --quick's test binaries take the RAM-based t…
fix(xtask): storytold#3705 Windows CI sizing follows the job object's…
test(xtask): storytold#3705 CI's RAM fallback with available RAM unkn…
Issue storytold#3705: ci --quick's test binaries take the RAM-based t…
fix(xtask): storytold#3705 Windows CI sizing follows the job object's…
test(xtask): storytold#3705 CI's RAM fallback with available RAM unkn…
Issue storytold#3705: ci --quick's test binaries take the RAM-based t…
fix(xtask): storytold#3705 Windows CI sizing follows the job object's…
test(xtask): storytold#3705 CI's RAM fallback with available RAM unkn…
Issue storytold#3705: ci --quick's test binaries take the RAM-based t…
docs(readme): storytold#3705 CI sizing on Windows follows the job obj…