Diagnostics/process memory snapshot #484

Closed
ToxicmaggotRP wants to merge 3 commits from upstream-pr/484 into main
ToxicmaggotRP commented 2026-11-24 03:57:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ToxicmaggotRP on 2026-11-24T03:57:25Z.


Diagnostics: report process private and resident memory

Related to #471 (memory growth during world load).

What

The diagnostics copy-stat line already samples process page faults through K32GetProcessMemoryInfo, but it only requests the base PROCESS_MEMORY_COUNTERS structure.

This change adds the extended counters needed to correlate copy-path measurements with the process's actual memory footprint:

  • Query PROCESS_MEMORY_COUNTERS_EX.
  • Log PrivateUsage (process private commit charge) and WorkingSetSize (resident working set) in GiB.
  • Preserve the previous successful page-fault sample if the OS query temporarily fails.
  • Omit the memory snapshot if the query fails, rather than logging misleading zero values.

This is process-wide telemetry. It does not attribute memory to individual pools or staging buffers, and it does not fix the memory ceiling by itself. It provides a reliable process-memory series to compare with existing copy statistics and the memory optimisations in #472.

Verification

  • Checked the repository's pinned windows-sys 0.61.2 API signature and structure fields.
  • Checked Microsoft's API contract for PROCESS_MEMORY_COUNTERS_EX.
  • Confirmed that only crates/victory-gpu/src/copystat.rs changes.
  • Branch is three commits ahead of main, with no upstream commits missing.
  • cargo fmt, cargo check -p victory-gpu --features diagnostics, tests, and a Windows diagnostics run were not performed because Rust/Cargo are unavailable in the development environment.

No game assets or proprietary files used.

AI-assisted contribution (ChatGPT).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574270603 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/484). Originally posted by [ToxicmaggotRP](https://github.com/ToxicmaggotRP) on 2026-11-24T03:57:25Z. --- # Diagnostics: report process private and resident memory Related to #471 (memory growth during world load). ## What The diagnostics copy-stat line already samples process page faults through `K32GetProcessMemoryInfo`, but it only requests the base `PROCESS_MEMORY_COUNTERS` structure. This change adds the extended counters needed to correlate copy-path measurements with the process's actual memory footprint: - Query `PROCESS_MEMORY_COUNTERS_EX`. - Log `PrivateUsage` (process private commit charge) and `WorkingSetSize` (resident working set) in GiB. - Preserve the previous successful page-fault sample if the OS query temporarily fails. - Omit the memory snapshot if the query fails, rather than logging misleading zero values. This is process-wide telemetry. It does not attribute memory to individual pools or staging buffers, and it does not fix the memory ceiling by itself. It provides a reliable process-memory series to compare with existing copy statistics and the memory optimisations in #472. ## Verification - Checked the repository's pinned `windows-sys 0.61.2` API signature and structure fields. - Checked Microsoft's API contract for `PROCESS_MEMORY_COUNTERS_EX`. - Confirmed that only `crates/victory-gpu/src/copystat.rs` changes. - Branch is three commits ahead of `main`, with no upstream commits missing. - `cargo fmt`, `cargo check -p victory-gpu --features diagnostics`, tests, and a Windows diagnostics run were not performed because Rust/Cargo are unavailable in the development environment. No game assets or proprietary files used. AI-assisted contribution (ChatGPT).
mercuryVM commented 2026-11-24 10:03:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:13:35Z.

Review: APPROVED


Tested 3b7e1d5 on Windows 11, RTX 5070, MSVC: the workspace passes (264: 195 outside victory-shader, plus victory-shader --lib with --test-threads=1, 69 passed). The first full run timed out on the known parallel VALU GPU-test hang that #433 addresses, which has nothing to do with this change. cargo check -p victory-gpu --features diagnostics is clean.

  • K32GetProcessMemoryInfo with cb = size_of::<PROCESS_MEMORY_COUNTERS_EX>() and the base-struct pointer cast is the documented way to get PrivateUsage.
  • Keeping the previous fault sample when the query fails (instead of resetting it) avoids a one-interval spike of lifetime faults.
  • PrivateUsage (commit) and WorkingSetSize (resident) are the two numbers #471 needs.

Diagnostics only, so release builds are unchanged. No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6036483516 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/484#pullrequestreview-6036483516). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T09:13:35Z. **Review:** APPROVED --- Tested 3b7e1d5 on Windows 11, RTX 5070, MSVC: the workspace passes (264: 195 outside `victory-shader`, plus `victory-shader --lib` with `--test-threads=1`, 69 passed). The first full run timed out on the known parallel VALU GPU-test hang that #433 addresses, which has nothing to do with this change. `cargo check -p victory-gpu --features diagnostics` is clean. - `K32GetProcessMemoryInfo` with `cb = size_of::<PROCESS_MEMORY_COUNTERS_EX>()` and the base-struct pointer cast is the documented way to get `PrivateUsage`. - Keeping the previous fault sample when the query fails (instead of resetting it) avoids a one-interval spike of lifetime faults. - `PrivateUsage` (commit) and `WorkingSetSize` (resident) are the two numbers #471 needs. Diagnostics only, so release builds are unchanged. No issues found. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 00:05:30 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!484
No description provided.