fix(victory-hle): remove released dstorage File entries from WALLS_FILES #421

Open
github-bot wants to merge 1 commit from github-bot/gh-421 into main AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 18:07 UTC · original
Lewandox:fix/dstorage-remove-released-files-from-walls-files → main · +58 −4 · 1 files · 1 commits · open

Summary

Fixes a memory leak and stale-address collision in WALLS_FILES when DirectStorage file objects are released (third_party/victory/crates/victory-hle/src/modules/dstorage.rs):

  1. Remove released files from WALLS_FILES:
    • Previously open_file appended (file as usize, path) to the global WALLS_FILES vector and never removed it when the File instance was released. Over a long session this leaked path strings and could return a stale filename if a new File reused the freed heap address.
    • Adds a Drop implementation on File (via its stored key: AtomicUsize set on creation) that removes its entry from WALLS_FILES upon release, and deduplicates on insert.
  2. Unit test:
    • Adds releasing_a_file_removes_it_from_walls_files verifying WALLS_FILES tracks an opened file and removes it as soon as the final Release drops the instance.

Verification

  • cargo test -p victory-hle --lib modules::dstorage::tests
  • cargo xtask policy inside third_party/victory
**@⁠Lewandox** on GitHub · 2026-11-26 18:07 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/421) `Lewandox:fix/dstorage-remove-released-files-from-walls-files` → `main` · +58 −4 · 1 files · 1 commits · open ## Summary Fixes a memory leak and stale-address collision in `WALLS_FILES` when DirectStorage file objects are released (`third_party/victory/crates/victory-hle/src/modules/dstorage.rs`): 1. **Remove released files from `WALLS_FILES`**: - Previously `open_file` appended `(file as usize, path)` to the global `WALLS_FILES` vector and never removed it when the `File` instance was released. Over a long session this leaked path strings and could return a stale filename if a new `File` reused the freed heap address. - Adds a `Drop` implementation on `File` (via its stored `key: AtomicUsize` set on creation) that removes its entry from `WALLS_FILES` upon release, and deduplicates on insert. 2. **Unit test**: - Adds `releasing_a_file_removes_it_from_walls_files` verifying `WALLS_FILES` tracks an opened file and removes it as soon as the final `Release` drops the instance. ## Verification - `cargo test -p victory-hle --lib modules::dstorage::tests` - `cargo xtask policy` inside `third_party/victory`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:10:29 +00:00
github-bot force-pushed github-bot/gh-421 from 23c3b70034 to 0ef077a736 2026-11-26 19:34:55 +00:00 Compare
github-bot force-pushed github-bot/gh-421 from 0ef077a736 to 3e697c29c9 2026-11-27 00:37:11 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/421/head:github-bot/gh-421'
git switch 'github-bot/gh-421'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-421'
git switch 'github-bot/gh-421'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-421'
git switch 'github-bot/gh-421'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-421'
git switch 'main'
git merge --squash 'github-bot/gh-421'
git switch 'main'
git merge --ff-only 'github-bot/gh-421'
git switch 'main'
git merge 'github-bot/gh-421'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.