No host-side leak in 13 minutes of Series S play (RTX 4070 Ti SUPER); the 9.6 GB 'while lists were made' figure is about 1 GB measured #226
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay#226
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Smoodie7 on GitHub · 2026-11-27 11:08 UTC · original
I looked for a memory leak in my three Series S logs from #212 (RTX 4070 Ti SUPER, 32 GB,
-Dlss quality -FrameGen, warmed cache): a 13-minute run and the two 6-minute A/B runs. I didn't find one in the layer's own memory. The one large number that looks like a leak is a measurement artifact, and I checked the real cost on this machine.1. The layer's tracked memory stays flat after the world loads
These are the
copystatmemory lines from the 13-minute run, once the world was loaded:Copies, windows, textures and staging go up and down with the scene, and they come back down. Upload buffers are recycled: about 47,600 were made, but only 3 to 10 are alive at any sample, and scratch chunks come from the spare list (911,755 taken). Private memory still rises by about 0.1 to 0.15 GB a minute. "Our own allocations" grew 290 MB in the first 4 minutes and then 119 MB over the next 6 (about 20 MB a minute, mostly blocks under 4 KiB), so it is slowing down rather than climbing steadily. The rest follows the world streaming in and is not held by the host objects the memory line counts. The two A/B runs show the same shape: private memory sits at about 21.3 to 22.3 GB once the world is loaded.
2. "private bytes grew … while lists were made" overstates the list cost by about 10x
The
memory, moreline reportshost lists: 1489 made by the host, 1087 preludes, private bytes grew 9613 MB while lists were made. In run A, the same scene gives 4,236 MB for 1,476 lists. Read as is, that is 3 to 6.5 MB per host list, and 4 to 10 GB in total.That counter is the process's private-byte delta around
make_list, so it also picks up whatever other threads allocate during that time. The world load makes about 800 lists while it streams. To get the real cost, I measured allocator + list creation by itself on the same card and driver (621.40), in a standalone program on the high-performance adapter:CloseResetand closeSo about 1,500 host lists and preludes cost on the order of 1 GB here, not 9.6 GB. The NVIDIA driver also gives memory back on
Reset, so a list that once recorded a big frame doesn't keep it. The current line says "may shrink … on another thread's account" in its comment, but the number looks like a leak in reports (it was 9.6 GB in mine). It could say "upper bound", or the cost could be sampled per list on one thread at start.3. What could actually save RAM on 32 GB PCs
Resetand given back once the GPU fence passes, would bound this by the lists in flight instead of all 1,489. From the measurements above, the saving here is about 0.5 to 1 GB. It is real, but smaller than the 9.6 GB line suggests.I can run any of these, or a build with a per-list measurement, on this machine.
@Smoodie7 on GitHub · 2026-11-27 11:15 UTC · original
Correction to the allocator pool idea above: after reading
HostList, I don't think it saves much. A host list has to keep its allocator from its reset until its next reset, because it is recorded, closed and can be submitted again, andresetruns only after the last submission. So there is no point where the allocator could go back to a pool while the list still exists. The driver also already trims an allocator to about 0.5 MB onReset, as measured above.The only remaining gain would be an empty list that has been reset and sits open, waiting for its next recording. That costs about 0.5 to 0.7 MB on this card, compared with nothing for an allocator with no list open on it. Opening the list lazily at its first command would recover that, at most about 0.7 GB for the 1,489 lists here. But it touches every recording path through
rec::Rec, so I'm not proposing it without a count of how many lists are actually idle at once. The useful part of this issue is the measurement: no host-side leak, and the 9.6 GB line is mostly other threads' allocations.@TaynanGT on GitHub · 2026-11-27 11:18 UTC · original
@Smoodie7 I opened #228 to label this as the sum of process-wide private-byte changes during list creation. Other threads can allocate or free memory in those intervals, and simultaneous calls can overlap. The standalone allocator measurement is the right source for the per-list cost. I’ve also added that distinction to the measurements guide so future reports can keep the two numbers separate.
@TaynanGT on GitHub · 2026-11-27 11:30 UTC · original
@Smoodie7 Keeping the allocator with the list follows from that lifetime.
HostList::resetruns after the previous submissions finish, resets the allocator, and reopens the native list on it. To size a lazy-open change, I'd measure the high-water count of open, unrecorded lists on the same route.has_recorded_workonly checks deferred copies and tracked states, so it can't supply that count on its own. The corrected memory label is now in main via #228.