fix(victory-hle): eliminate dstorage ENQUEUED leak/desync, bound page history, and reuse capped scratch buffers #401
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!401
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-401"
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?
@Lewandox on GitHub · 2026-11-26 17:19 UTC · original
Lewandox:fix/dstorage-bounded-tracking-and-scratch-reuse→main· +346 −170 · 1 files · 1 commits · closed without mergingSummary
Fixes unbounded memory retention / FIFO desync and reduces per-request heap churn in DirectStorage (
third_party/victory/crates/victory-hle/src/modules/dstorage.rs):ENQUEUEDleak, FIFO desync, and global mutex contention:as_enqueuedpushed eachPAGE_DESTINATIONrequest's page-array snapshot into a globalENQUEUEDMutex<Option<HashMap<usize, VecDeque<Vec<usize>>>>>, andfilled()popped from it when the worker ran.close_lane) while requests were unsubmitted/queued, or ifexecute()failed beforeinto_destination()(e.g. invalid args, read failure, zlib error), those snapshots leaked forever and permanently shifted the FIFO queue for any future request reusing that page-array address (and parallel workers could even pop each other's snapshots out of order).enqueued_pages: Option<Vec<usize>>directly to eachCommand::Read/Lane::readsentry /Jobremoves the globalENQUEUEDmutex completely, guarantees zero leaks on close or early failure, and pairs every worker execution with its exact enqueue-time snapshot.LAST_RUN/SAME_RUNStracking memory:LAST_RUNandSAME_RUNSinto a singlePAGE_HISTORYmap (one lock + one lookup instead of two) and caps it atMAX_PAGE_HISTORY(4,096) entries so long sessions with churning page-array addresses cannot grow unboundedly.with_scratch, max 2 buffers, each capped at4 MiBon return) for file-read bounce buffers, compressed source reads, zlib+BCPack intermediate buffers, and non-consecutive physical-page staging buffers.VirtualAlloc/VirtualFreeTLB shootdowns during world streaming while dropping any oversized (>4 MiB) buffer immediately so idle workers never retain large RAM.PAGE_DESTINATIONrequest early drops its enqueue snapshot cleanly without corrupting subsequent requests on the same page-array address.PAGE_HISTORYstays strictly bounded atMAX_PAGE_HISTORYeven under heavy address churn.with_scratchcalls preserve independent buffers, reuse capacity up to the cap, and drop oversized buffers on return.Verification
cargo test -p victory-hle --lib modules::dstorage::testscargo xtask policyinsidethird_party/victory@Lewandox on GitHub · 2026-11-26 19:15 UTC · original
Closing as superseded after #409 (\dstorage.rs\ was rewritten around \Lanes/\Scheduler/\Traced, removing the old \ENQUEUED\ map and unbounded page history). The remaining \WALLS_FILES\ leak fix stays tracked in #421.
Pull request closed