Run: let go of the executable's bytes once it is loaded (228 MB RAM) #2149
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2151"
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 desplmfao on 2026-11-25T06:19:11Z.
Problem
run()reads the executable into aVec(original) and makes a patched copy of it for the loader (prepared.bytes). Both are locals ofrun(), which only returns when the title exits. So the process keeps two copies of the executable in memory for the whole run, although aftervictory_loader::loadthe patched copy is on disk and loaded, and neither buffer is used again.For Grand Theft Auto VI (Series X 1.0.2.1) the executable is 114 MB, so that's 228 MB held for nothing.
Change
drop((original, prepared))right aftervictory_loader::load. Nothing after that point uses either.imagedoesn't borrow them; the compiler would refuse the drop if it did.Measured
Allocations of 1 MiB or more tracked by call site, with a counting global allocator (diagnostics only, not part of this PR). RTX 5080, Linux, proton-cachyos 11.0:
std::fs::readinrun()victory_loader::prepareTested
cargo clippy -p victory --all-targets -- -D warnings: clean.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:23:55Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory— 12 passed, 0 failedcargo clippy -p victory --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean drop of raw executable bytes after loading. Note for triage: #2071 makes the same change in
apps/victory/src/run.rs.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:33:09Z.
Review: COMMENTED
Static review only: apps/victory is Windows-only (Win32/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Executable bytes released once loaded (228 MB) — memory-footprint fix; possible duplicate of #2071 (same 'free executable bytes after mapping' change); maintainer should pick one.
Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T06:25:12Z.
Closing as a duplicate of #2071, which makes the same change and came first. I missed it when I searched. For #2071, the measurement from here: tracking allocations of 1 MiB or more by call site in Grand Theft Auto VI, the two 114 MB blocks (
std::fs::readinrun()andvictory_loader::prepare) are gone, and VIctory's heap in the menu goes from 1,092 to 863 MB. RTX 5080, Linux, proton-cachyos 11.0.Pull request closed