mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Count the recording copies whose control memory the game reused, behind the new NX2NAVI_COPY_RETIRE switch.
Recording copies are retired only when the game adds their control memory again (release_copies), and the fresh 0.10.0 session's "mem: sizes" lines show them growing for good: 220 at frame 600, 223,646 (56.3 MiB) at frame 39600, with no zombies. This is the first stage of retiring them: it only counts, so the second stage can be judged on numbers. With copy_retire = 1, copy_add queues each copy's control position, and an "nvn copy sweep" thread at the lowest priority fingerprints the 16 bytes there within 5 seconds, then visits up to 4096 copies every 5 seconds from a cursor and counts those no submission used for 5 minutes whose bytes changed or whose memory is no longer mapped. The "mem: sizes" line gains "of those idle, control memory changed" and "control memory gone". Nothing is freed. Our driver never writes control memory, so the bytes compared are the game's own leftovers; a reuse that writes the same bytes is not seen and the counts are a lower bound. Every read of guest memory happens on the sweep thread, never on a recording thread: a lazily armed range is not read at all, an untouched lazy-heap page is taken as zeros, and the read holds the mapping with mem_read_hold. The sweep takes copy_lock shared only, 64 lookups at a time, and its queue has a lock of its own that is never held with copy_lock. Copies that share a control position (EndRecording falls back to the block's start when it is full) each keep their own record. The age ring behind "of them unused for 5 minutes" grows from 1024 to 65536 minutes: at 1024 a copy last used 17 hours earlier shared its slot with the minute now and counted as recent. New row COPY_RETIRE (0|1, default 0, restart) in known[], sections[] (diagnostics) and metas[], and a copy_retire entry in nx2navi.ini.example. tests/copy_sweep_check.py cuts the fingerprint, visit, queue and pass functions from nvn_api_cmd.c with stub copies and stub guest memory: changed bytes count as changed, unmapped memory as gone, unchanged bytes and copies used within 5 minutes count nothing, armed ranges and untouched pages are never read, retired and replaced copies leave the counts, and two passes over 5000 copies visit each once or twice. The cfg row check reports no missing rows, launcher_test passes, and the compile check adds no warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1101,6 +1101,12 @@
|
||||
# "ref" is perf_lock_timing_here, which the link map names), the recorder's waits, and the texture lock's holds over
|
||||
# 1 ms. Off by default.
|
||||
# lock_time = 0
|
||||
# 1: with trace = perf, the "mem: sizes" line also counts the recording copies (the game's recorded command lists,
|
||||
# kept until the game hands their control memory over again) that no submission used for 5 minutes and whose control
|
||||
# memory the game has written over since, or no longer maps: copies the game will not use again. A thread of its own
|
||||
# reads 16 bytes of game memory per copy every 5 seconds; nothing is freed. The count is a lower bound: memory written
|
||||
# over with the same bytes is not seen. Read at start. Default: 0.
|
||||
# copy_retire = 0
|
||||
# Texture entries the bindless texture pool may create in one refresh (images and their uploads); the rest wait for
|
||||
# the next refresh and show their stand-in until then. Lower spreads streaming over more frames (smaller hitches, a
|
||||
# frame or two of pop-in); higher loads sooner.
|
||||
|
||||
Reference in New Issue
Block a user