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

Open
opened 2026-11-27 11:14:22 +00:00 by github-bot · 3 comments
Owner

@⁠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 copystat memory lines from the 13-minute run, once the world was loaded:

Time Private Host copies of title memory Windows outside buffers Host textures Texture staging Our own allocations
09:53:47 19.5 GB 4,043 / 3,000 MB 2,236 MB 2,496 MB 51 MB 1,117 MB
09:58:07 21.1 GB 4,227 / 2,989 MB 2,228 MB 2,294 MB 65 MB 1,407 MB
10:04:03 22.0 GB 4,391 / 3,421 MB 2,656 MB 2,738 MB 59 MB 1,526 MB

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, more line reports host 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:

Direct allocator + list Private bytes each
Created, list open 0.68 MB
After Close 0.77 MB
Allocator alone ~0 MB
Extra closed list on the same allocator 0.03 MB
After recording 500 / 4,000 / 16,000 draws, Reset and close 0.49 / 0.50 / 0.43 MB kept

So 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

  • Allocator pool: each host list keeps its own allocator (plus a prelude allocator) for the life of the title list. A pool, taken at Reset and 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.
  • The remaining growth is in the title's own memory, which follows the world, not in host objects. On this PC the free RAM goes down to 1.6 GB while the card has 7.7 GB free (#212), so the RAM throttle work (#96 / #126 / #147) and the "windows on the card" trial are where the bigger margin is. As you noted, card windows keep their PC-side backing, so that trial needs private, shared and free VRAM side by side. That run is next.

I can run any of these, or a build with a per-list measurement, on this machine.

**@⁠Smoodie7** on GitHub · 2026-11-27 11:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/226) 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 `copystat` memory lines from the 13-minute run, once the world was loaded: | Time | Private | Host copies of title memory | Windows outside buffers | Host textures | Texture staging | Our own allocations | |---|---:|---:|---:|---:|---:|---:| | 09:53:47 | 19.5 GB | 4,043 / 3,000 MB | 2,236 MB | 2,496 MB | 51 MB | 1,117 MB | | 09:58:07 | 21.1 GB | 4,227 / 2,989 MB | 2,228 MB | 2,294 MB | 65 MB | 1,407 MB | | 10:04:03 | 22.0 GB | 4,391 / 3,421 MB | 2,656 MB | 2,738 MB | 59 MB | 1,526 MB | 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, more` line reports `host 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: | Direct allocator + list | Private bytes each | |---|---:| | Created, list open | 0.68 MB | | After `Close` | 0.77 MB | | Allocator alone | ~0 MB | | Extra closed list on the same allocator | 0.03 MB | | After recording 500 / 4,000 / 16,000 draws, `Reset` and close | 0.49 / 0.50 / 0.43 MB kept | So 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 - **Allocator pool:** each host list keeps its own allocator (plus a prelude allocator) for the life of the title list. A pool, taken at `Reset` and 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. - **The remaining growth is in the title's own memory**, which follows the world, not in host objects. On this PC the free RAM goes down to 1.6 GB while the card has 7.7 GB free (#212), so the RAM throttle work (#96 / #126 / #147) and the "windows on the card" trial are where the bigger margin is. As you noted, card windows keep their PC-side backing, so that trial needs private, shared and free VRAM side by side. That run is next. I can run any of these, or a build with a per-list measurement, on this machine.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 11:14:22 +00:00
Author
Owner

@⁠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, and reset runs 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 on Reset, 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.

**@⁠Smoodie7** on GitHub · 2026-11-27 11:15 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/226#issuecomment-7216869854) 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, and `reset` runs 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 on `Reset`, 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.
Author
Owner

@⁠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:18 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/226#issuecomment-7216930539) @⁠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.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 11:30 UTC · original

@⁠Smoodie7 Keeping the allocator with the list follows from that lifetime. HostList::reset runs 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_work only 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.

**@⁠TaynanGT** on GitHub · 2026-11-27 11:30 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/226#issuecomment-7217148755) @⁠Smoodie7 Keeping the allocator with the list follows from that lifetime. `HostList::reset` runs 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_work` only 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.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/TaynanGT--Vice-Tay#226
No description provided.