[pr-fix][memory] CPU mirror files a PC reset left behind are removed at the next start #101
Loading…
Reference in a new issue
No description provided.
Delete branch "iboom72/fix/cpu-mirror-leftovers"
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?
What it changes
With
DARNER_CARD_CPU_FILE=1(the default indarner.exe), the CPU mirrors of two-sided GPU buffers are temporary files in the cache'scpu-mirrorsfolder. They are deleted when their handles close. A run that ends with the PC itself (a hard reset, a power cut) closes nothing, so the files stay, and on Windows nothing removed them afterwards: only the tmpfs folder under Linux was cleared at start.Seen on one Windows 11 PC after a run that ended in a hard reset (Kernel-Power 41): 4,428 files, 7.1 GB, all created by that run, fully allocated on disk.
cpu_mirror_filesnow removes the files in the folder that no process holds, for both folders, so the Linux-only loop inlinux_tmpfs_mirrorsis gone. A file a running process maps is opened without sharing (tempfileuses share mode 0), so its removal is refused and it stays. The README row anddocs/windows-memory.mdsay so.Not covered: with
DARNER_CARD_CPU_FILEoff, the folder is not looked at, so leftovers from earlier runs stay until it is on again.How it was tested
3751c06conmain1a5286a7. The clippy gates and the tests ran on the same tree before it was committed.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo test --locked -p darner-gpu --lib fileback::: 3 passed, including the newleftovers_go_and_a_mapped_file_stays(a leftover file is removed, a mapped one stays and is still writable).cargo test --locked -p darner: 131 passed, 1 ignored, plus its integration tests.shadow::file_backing_tests::two_sided_mirrors_preserve_gpu_copies_and_later_cpu_writes, run with--ignoredandDARNER_CARD_CPU_FILE=1,DARNER_CARD_BUFFERS_MIN_KB=64,DARNER_SEND_OWN=1on an RTX 4070 Ti, with a leftover file planted in the mirror folder: passed, and the folder was empty afterwards.cargo xtask policy: 553 files ok.cargo test --workspace --lockedwas not run in full. Nothing was run under Linux/Proton, where the clean-up now runs from the shared code instead oflinux_tmpfs_mirrors. Twodarner.exeprocesses sharing one cache folder were not run together; the test covers a mapped file in the same process.Checklist
main.docs/asset-policy.md.Checked for overlap
shadow.rs); #9, #12, #16, #36, #59, #75 and #80 (play.rs); several add README rows. None touchesfileback.rsordocs/windows-memory.md.🤖 Generated with Claude Code