Wave 2.0-B: Fix system RAM leaks, add RAM/commit telemetry & 6-8 GB VRAM auto-presets #445
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!445
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-445"
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?
@Androtim on GitHub · 2026-12-06 00:51 UTC · original
Androtim:feat/v2.0-ram-leak-and-vram-presets→v2.0· +1171 −96 · 19 files · 2 commits · merged 2026-12-06 01:51 UTCSummary — MiniVI v2.0 Wave 2.0-B
Addresses the sustained system RAM leak/growth (~3–5 GB per 10 minutes), adds periodic process RAM/commit telemetry, and adds 6 GB / 8 GB DXGI VRAM smart auto-presets for
--stream-budget(without touchingmain).(Started from
origin/feat/v2.0-foundationf980573and rebased cleanly ontoorigin/v2.08e7e963after#443merged; 19 files changed.)1. System RAM Leak & Growth Fixes (
larp-hle,larp-gpu,apps/larp)Every host-memory pool, staging allocator, command-list hold queue, descriptor cache, thread-local scratch buffer, and heap allocation path was audited:
crates/larp-hle/src/modules/dstorage.rs) — Ported from upstreamgamingwithhomie/larpPR #276 (credited inNOTICE):staging_bytes()to charge plain-file bounce buffers (MEMORY_SOURCE == 0) andZLIB | BCPACKoverlappingintermediate_sizedecode buffers so streaming bursts cannot blow past the 32 MiBSTAGINGgate.into_destination).crates/larp-gpu/src/staging.rs,shadow.rs,heapfeed.rs):Staging::arenas(OWNED_SENDSandheapfeed::FEED) previously only appended 16 MiB Upload buffers and never released idle arenas after bursts.arenastoVec<Option<Arena>>(keeping queuedPiece::arenaindices stable), reusedNoneslots, popped trailingNones, and addedStaging::reclaim_idle()called duringhost::sweep()/shadow::let_go_idle()(keeping<= 2warm idle arenas normally,0below 2 GiB free RAM) with COM drops performed outside locks.SPARETrimming (crates/larp-gpu/src/host.rs):small_list()andcopy_list()previously left finished entries inSMALL_LISTS/COPY_LISTSretaining theirheld: Vec<Arc<Shadow>>(pinningShadows and 4 MiB loose windows withstrong_count > 1) and retained unbounded finishedID3D12GraphicsCommandLists after bursts. Extracted sharedsweep_aux_pool()+ periodicreclaim_idle_aux_lists()insweep()to immediately drop finishedheld/leaseobjects and cap idle finished lists at32outside pool locks.Reuse::reuse()(> 256 KiB capacity drop) inHostList::clear()tonamed,entries,away,twins,card_reads,card_fills,card_declared,card_closed, andnotes.Spare::trim_to()+trim_spare()insweep()to shrink pooledSPAREscratch buffers from128 MiBdown to32 MiB(< 4 GiB free RAM) or0(< 2 GiB free RAM).crates/larp-gpu/src/allocators.rs):FREE[DIRECT / COPY]pooledID3D12CommandAllocators without limit; capped at32per kind (MAX_FREE_ALLOCATORS) and addedtrim_free()insweep()(32 / 16 / 8by free RAM) with drops outside locks.WHOLEPruning (crates/larp-gpu/src/descriptor.rs,draw.rs):descriptor::Heap::dropto calldraw::forget_heap()so destroyed shader-visible descriptor heaps immediately remove theirPicksentries fromKEPT_HEAP_PICKSinstead of leakingArc<Shadow>spans.prune_stale_whole()indraw.rsto drop expiredlast < frameentries fromWHOLEoncelen > 256.crates/larp-gpu/src/shadow.rs):POOL_USED_AT) +trim_snapshot_pool()inlet_go_idle()to trim512+ MiBsnapshotVec<u8>pools to64 MiBafter 15s idle or< 4 GiBfree RAM, and to0after 30s idle or< 2 GiBfree RAM (outside locks).Weak<Shadow>s and oversized capacity fromCARDEDduringlet_go_idle().crates/larp-gpu/src/texevents.rs,bufobj.rs,finals.rs):texevents::with_runs::READ, plus diagnosticsbufobj::check::SCRATCHandfinals::check::SCRATCH) down to4 MiBafter oversized texture/buffer reads.Objects::filledentries intexevents::release()andObjects::last_setinobject_released().mimallocGlobal Allocator (Cargo.toml,apps/larp/Cargo.toml,apps/larp/src/main.rs,apps/larp/src/bin/larp.rs):mimalloc(0.1.52, default features — pure Rust#[global_allocator]without C hook override) on Windows non-diagnosticsbuilds ofMiniVIandlarpto prevent Windows CRT heap fragmentation / cross-thread lock contention and purge idle multi-MB decode/bounce pages back to the OS promptly (copystat::HEAPremains intact underdiagnostics).crates/larp-gpu/src/host.rs):private_bytes()outsidediagnosticsbuilds and appendedRAM <mb> MB (<gib> GiB), commit <mb> MB (<gib> GiB)(formatted viaformat_ram_commit) to the periodic 5-secondtracing::info!stats line.2. 6 GB & 8 GB VRAM Smart Auto-Presets (
apps/larp/src/play.rs,apps/larp/src/run.rs)CreateDXGIFactory1(honoringLARP_ADAPTER/VICTORY_ADAPTERindex or substring, or selecting the primary hardware adapter) when neither--stream-budgetnorLARP_STREAM_BUDGET(VICTORY_STREAM_BUDGET) is explicitly provided:<= 6.5 GiBVRAM: auto-selects--stream-budget 1500and logs cleanly<= 8.5 GiBVRAM: auto-selects--stream-budget 2500and logs cleanly> 8.5 GiBVRAM: leaves uncapped (None)--stream-budgetandLARP_STREAM_BUDGET/VICTORY_STREAM_BUDGET(including0/off/uncapped) always override auto-presets acrossplayandrun.Verification
cargo xtask policy: 503 files ok, 0 violationscargo clippy --workspace --all-targets --locked -- -D warnings: 0 warningscargo check --workspace --features diagnostics --locked: 0 errorscargo test --workspace --locked: all non-ignored unit tests pass across every workspace crate (including new PR #276 staging gate, staging slot reclaim, aux list sweep, allocator pool cap, heap drop / whole prune, snapshot pool trim, spare trim, telemetry format, and 3-tier + override VRAM preset tests)cargo build --release --locked --bin MiniVI: builds cleanly (withDXCset)3ff3d2a979toefdb65bc56github-bot referenced this pull request2026-12-06 01:01:21 +00:00