apps/victory: use dedicated Win32 HeapCreate global allocator and add VICTORY_NO_WATCH_GUARDS toggle #2422
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2424"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by faycalbaklouti on 2026-11-25T13:14:25Z.
Target upstream:
Marvisak/VIctory(also applicable toBelobug/VIctory-Belobug-AMDandfxceless/victory-fork)Problem
Sharing the default Win32 process heap (
GetProcessHeap()) between the runtime's Rust allocator and title/Wine/system allocations can cause lock inversion deadlocks when a vectored exception handler (VEH) or hook runs while another thread holds the process heap lock. Additionally, having an explicitVICTORY_NO_WATCH_GUARDSdiagnostic switch is useful when bisecting page-guard issues.Solution
apps/victory/src/private_heap.rsimplementing a#[global_allocator]backed by a dedicated Win32HeapCreateheap so runtime allocations never contend withGetProcessHeap().apps/victory/src/main.rsandapps/victory/Cargo.toml.VICTORY_NO_WATCH_GUARDStoggle incrates/victory-gpu/src/watch.rs.Verification
git apply --checkpasses cleanly onMarvisak/VIctorymain(direct zero-conflict apply).About our fork & censorship-resistant preservation effort:
This fix comes from gta6-vi-port, our open-source Linux (GE-Proton) + NVIDIA RTX 4090 fork of VIctory and peer-to-peer Radicle archival effort (mirroring 92+ community porting repositories across public Radicle seeds so open-source porting research survives centralized takedowns; open-source code only, no game files/keys/binaries).
rad:z39ofPhQC1siudH9BF3xsmAMmUqxc).onionVP9+Opus viewer:http://kwnoaeecpmxd6eetqfa7fxlymvxnh5du2i6wxr44t4mc7cgch5pw23id.onion/)Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T13:18:36Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11:HeapCreateglobal allocator (private_heap.rs) andVICTORY_NO_WATCH_GUARDStoggle compile cleanly and pass all allocator, alignment, and watch tests.cargo test -p victory: 16/16 passed (14 unit including all 4private_heap::tests+ 2 census).cargo test -p victory-gpu watch::tests: 6/6 passed.cargo clippy -p victory -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 184 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T13:19:33Z.
Review: COMMENTED
apps/victory: private HeapCreate global allocator to avoid AB-BA deadlock between the process heap lock and GUARDS VEH (+317). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Sound motivation; the deadlock scenario is plausible with a vectored exception handler touching Rust collections. Windows-only, needs validation.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:32:27Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/watch.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T16:54:32Z.
Both halves check out:
Private heap — the over-alignment math is subtly right but worth the comment being explicit:
size + alignis only sufficient becauseHeapAllocalready returns 16-aligned blocks andHEADER_SIZE = 8, which boundsoffset ≤ align(an unaligned base would needsize + align + HEADER - 1). Lazy CAS init and the back-pointer scheme are sound; realloc correctly avoidsHeapReAllocfor over-aligned blocks where the header would move.VICTORY_NO_WATCH_GUARDS— earlyNonefromtrackmatches the existing "untracked" path, so callers degrade the same way asruntime_memorymisses. The trade-off is correctly scoped as an env toggle: writes stop being observed, so stale textures are the expected symptom while it sidesteps the AB-BA deadlock withGUARDS.Imported from Marvisak/VIctory. Originally posted by faycalbaklouti on 2026-11-30T19:17:44Z.
The prepared head
ae18536c1a6eis directly based on mirror main63bcca43. Both registration paths now calltrack_as, and the diagnostic opt-out is checked there (watch.rs:322,328,332). It is off by default. When enabled it disables this write observation, so it is a diagnostic choice rather than a rendering fix.The allocator documents the back-pointer alignment bound in
private_heap.rs:93–97. The earlier Windows review applied to the prior patch; no suite has been run on this rebased head while the benchmark holds the compute lock.Imported from Marvisak/VIctory. Originally posted by faycalbaklouti on 2026-11-30T20:34:31Z.
At
e36072c02f85: Default Clippy passed on the old head, but--all-featuresenabled diagnostics and registeredPrivateHeapandCountingAllocsimultaneously. There is now one registration. All four allocator operations use the private Win32 heap; diagnostics keeps the original successful-allocation, resize, free and large-allocation reporting. The new GPU library test checks private-heap ownership and exact live-byte deltas.With Rust 1.98.1, targeting
x86_64-pc-windows-msvcwith cargo-xwin and running the Windows tests under Wine:cargo clippy --workspace --all-targets --locked -- -D warnings: exit 0cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: exit 0cargo test --workspace --locked: exit 101Regression test:
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 251 filtered out; finished in 0.00s.The full workspace test did not pass under Wine. Unchanged main reproduced all five reported failures: DLL thread attach, two stand-in window tests, loopback, and an NTFS hard-link expectation. The workspace run then stalled in a nested game-save child and was stopped; later tests remain unverified. This is not a claim that Windows CI is green.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.