[performance][memory] Parked texture blocks keep 1.7 GB free in PC memory, and neither DARNER_POOL_TRIM nor DARNER_TEX_COMPACT reaches them #375

Open
opened 2026-12-04 18:19:36 +00:00 by iBooM72 · 3 comments
Contributor

What you see

At the end of a 41-minute open-world run on a 12 GB card, the texture park holds 54 blocks of 64 MB in the PC's memory (3,456 MB). Of that, 1,707 MB is free inside blocks that still hold some textures. The card ledger line is "parked texture blocks: 54 holding 3456 MB (1739 live, 1707 free, 10 resting)".

I posted the whole shared-memory split in the "PC memory use is still high" known-issue thread (#197, issuecomment-868521). This issue is about one part of it that needs a code change rather than more reports.

From reading the code at f3840d73 (not measured):

  • The parked pools keep at most one empty block each (pool.rs:81-90), so empty blocks do go back. The 1.7 GB is free space inside blocks that still hold textures.
  • DARNER_POOL_TRIM acts on the card's texture blocks and on staging and buffers (pool.rs:60-73, :91-94), not on the parked pools.
  • DARNER_TEX_COMPACT (best fit) applies to pools made with Pool::textures (TEXTURES and SMALL, pool.rs:955-958). The parked pools are made with Pool::with_budget (:1409-1412), which always cuts from the fullest block.

In one local run with DARNER_POOL_TRIM=1 (same PC and build, route not the same as the baseline), shared memory was no lower than the baseline. The texture re-upload warnings went from 6.9 to 10.7 a minute (86 in 12 minutes against 79 in 7). A few textures showed white in that run; I didn't check whether they also show without the switch.

Possible directions, none of them tried:

  • a best fit for the parked pools;
  • moving the last textures out of a sparse parked block so it empties, as #332 (DARNER_PAGE_DRAIN) does for page-buffer heaps.

Before you post

  • I read the pinned known-issues thread at the top of the issue list (https://git.gtahub.st/TrustNo1/Darner/issues). If my problem is listed there, I reply in that thread instead of opening this.
  • This issue is about one problem.
  • I verified the game files and run no mods.

RAY TRACING in F1

Off

GPU and driver

RTX 4070 Ti 12 GB, driver 621.01

CPU, RAM and Windows version

i7-14700K, 32 GB, Windows 11 (build 26300)

Darner release or commit

v2026.12.03.02

Settings

Series X, 1080p to 1440p, DLSS Quality, DLSS frame generation 2x, ray tracing off, texture quality high. Started from the play launcher with its defaults, including DARNER_TEX_PARK=1. The full switches line is at the top of the log.

Log files attached

darner-play-20261204-093959-22072.log (baseline) and darner-play-20261204-152748-8256.log (DARNER_POOL_TRIM=1) are not attached (52 MB and 12 MB). I can share redacted copies.

Are you working on a fix?

No

### What you see At the end of a 41-minute open-world run on a 12 GB card, the texture park holds 54 blocks of 64 MB in the PC's memory (3,456 MB). Of that, 1,707 MB is free inside blocks that still hold some textures. The card ledger line is "parked texture blocks: 54 holding 3456 MB (1739 live, 1707 free, 10 resting)". I posted the whole shared-memory split in the "PC memory use is still high" known-issue thread (#197, issuecomment-868521). This issue is about one part of it that needs a code change rather than more reports. From reading the code at `f3840d73` (not measured): - The parked pools keep at most one empty block each (`pool.rs:81-90`), so empty blocks do go back. The 1.7 GB is free space inside blocks that still hold textures. - `DARNER_POOL_TRIM` acts on the card's texture blocks and on staging and buffers (`pool.rs:60-73`, `:91-94`), not on the parked pools. - `DARNER_TEX_COMPACT` (best fit) applies to pools made with `Pool::textures` (`TEXTURES` and `SMALL`, `pool.rs:955-958`). The parked pools are made with `Pool::with_budget` (`:1409-1412`), which always cuts from the fullest block. In one local run with `DARNER_POOL_TRIM=1` (same PC and build, route not the same as the baseline), shared memory was no lower than the baseline. The texture re-upload warnings went from 6.9 to 10.7 a minute (86 in 12 minutes against 79 in 7). A few textures showed white in that run; I didn't check whether they also show without the switch. Possible directions, none of them tried: - a best fit for the parked pools; - moving the last textures out of a sparse parked block so it empties, as #332 (`DARNER_PAGE_DRAIN`) does for page-buffer heaps. ### Before you post - [x] I read the pinned known-issues thread at the top of the issue list (https://git.gtahub.st/TrustNo1/Darner/issues). If my problem is listed there, I reply in that thread instead of opening this. - [x] This issue is about one problem. - [x] I verified the game files and run no mods. ### RAY TRACING in F1 Off ### GPU and driver RTX 4070 Ti 12 GB, driver 621.01 ### CPU, RAM and Windows version i7-14700K, 32 GB, Windows 11 (build 26300) ### Darner release or commit v2026.12.03.02 ### Settings Series X, 1080p to 1440p, DLSS Quality, DLSS frame generation 2x, ray tracing off, texture quality high. Started from the play launcher with its defaults, including `DARNER_TEX_PARK=1`. The full switches line is at the top of the log. ### Log files attached `darner-play-20261204-093959-22072.log` (baseline) and `darner-play-20261204-152748-8256.log` (`DARNER_POOL_TRIM=1`) are not attached (52 MB and 12 MB). I can share redacted copies. ### Are you working on a fix? No
Contributor

Since #332 is cited: two things from the rig it was measured on, and one from the code.

The same ledger line at the end of six 12 min drives today (RTX 5070 12 GB, Series S profile, DLSS Quality, no ray tracing, main f3840d73, DARNER_TEX_PARK=1, one route): the park peaks at 2 to 5 blocks and ends at 1 to 4, almost empty: "3 holding 192 MB (11 live, 181 free)", "1 holding 64 MB (1 live, 63 free)", "4 holding 256 MB (15 live, 241 free)". So the same shape as yours (blocks kept for a few MB of textures), far smaller here; I have no Series X or 41 min run to compare.

On doing what #332 does: its drain moves tiles of reserved buffers, which UpdateTileMappings points at another heap while the resource and everything that refers to it stay. From reading pool.rs at f3840d73 (not tried), parked textures are placed resources (CreatePlacedResource), so emptying a sparse block means making the texture again in another block, copying it, and switching whatever holds the old one. What carries over is the rule: the emptiest block, only when the others have room for what it holds, one at a time, a rest after each.

One finding that may matter for the order of work: in our drives the drain alone gave no private-memory gain; it paid only once #319 gave memory back inside the heaps first. Here the free space is already there (1,707 MB), so that part may not apply.

We are working on memory on our side and will go on with it as soon as the current PRs (#319, #332) are dealt with. Our view is that memory is a real problem here, and that it needs to be treated in depth rather than switch by switch.

Nothing of this was tried on the park.

Since #332 is cited: two things from the rig it was measured on, and one from the code. The same ledger line at the end of six 12 min drives today (RTX 5070 12 GB, Series S profile, DLSS Quality, no ray tracing, main f3840d73, `DARNER_TEX_PARK=1`, one route): the park peaks at 2 to 5 blocks and ends at 1 to 4, almost empty: "3 holding 192 MB (11 live, 181 free)", "1 holding 64 MB (1 live, 63 free)", "4 holding 256 MB (15 live, 241 free)". So the same shape as yours (blocks kept for a few MB of textures), far smaller here; I have no Series X or 41 min run to compare. On doing what #332 does: its drain moves tiles of reserved buffers, which `UpdateTileMappings` points at another heap while the resource and everything that refers to it stay. From reading `pool.rs` at f3840d73 (not tried), parked textures are placed resources (`CreatePlacedResource`), so emptying a sparse block means making the texture again in another block, copying it, and switching whatever holds the old one. What carries over is the rule: the emptiest block, only when the others have room for what it holds, one at a time, a rest after each. One finding that may matter for the order of work: in our drives the drain alone gave no private-memory gain; it paid only once #319 gave memory back inside the heaps first. Here the free space is already there (1,707 MB), so that part may not apply. We are working on memory on our side and will go on with it as soon as the current PRs (#319, #332) are dealt with. Our view is that memory is a real problem here, and that it needs to be treated in depth rather than switch by switch. Nothing of this was tried on the park.
Collaborator

There is already a switch aimed at this case: DARNER_PARK_COMPACT_WASTE=1. It is off by default and marked "under test" in the README table. It is in v2026.12.03.02, the release you name. Your reading of DARNER_POOL_TRIM and DARNER_TEX_COMPACT looks right to me: neither one is what reaches the parked blocks.

What the switch does: when the parked blocks in PC memory have 1 GB or more free, and the free part is at least a third of what the blocks hold, the idle parked textures in them are let go, and emptied blocks give their shared memory back. Only blocks less than about a third full are emptied, so how much comes back depends on how many of your 54 blocks are that sparse. A texture that was let go is made again the next time it is used. It runs inside the existing texture compaction (DARNER_COMPACT_SPARSE, on unless set to 0), and it works even when the PC has plenty of room. Without the switch, that compaction only touches the parked blocks when the PC is short of commit, short of shared room, under memory pressure, or low on host room, which I would not expect on 32 GB, but have not checked.

Your ledger line meets the trigger: 1,707 MB free is more than 1,024 MB, and 1,707 x 3 is more than 3,456 MB.

We have not run this ourselves, so I can't say how much it gives back on your run. Could you try one run with DARNER_PARK_COMPACT_WASTE=1 on the same build and report:

  • the same memory lines at the end (the parked-blocks line and the shared-memory split);
  • the texture re-upload warnings per minute;
  • whether any textures show white.

The thing to watch is the re-upload rate. Your DARNER_POOL_TRIM=1 run went from 6.9 to 10.7 warnings a minute with a few white textures (and, as you noted, you did not check without the switch). If this switch does the same, that is worth knowing. If you can, a run with and without it on the same route would tell the two apart.

Details for the maintainer

  • README.md:744 (tag v2026.12.03.02): the DARNER_PARK_COMPACT_WASTE row.
  • crates/darner-gpu/src/resource.rs at v2026.12.03.02: compact_plan (about line 5341) sets park_waste when park_holes holds and the switch is on; park_wasteful (about line 5385) is free >= PARK_WASTE && free * 3 >= held; PARK_WASTE is 1 GiB; park_holes needs 512 MB or more free in the parked pools (COMPACT_HOLES).
  • do_park empties only blocks under 35% held (COMPACT_SPARSE_PER_MILLE 350, via sparse_parked_blocks, pool.rs about line 2365); your average is about 50% (1,739 of 3,456 MB live).
  • Without the switch, do_park needs short_of_commit || park_tight.
  • This is from reading the code and the issue text only. Not run, not measured.

This post was written with AI assistance (Claude Code).

There is already a switch aimed at this case: `DARNER_PARK_COMPACT_WASTE=1`. It is off by default and marked "under test" in the README table. It is in v2026.12.03.02, the release you name. Your reading of `DARNER_POOL_TRIM` and `DARNER_TEX_COMPACT` looks right to me: neither one is what reaches the parked blocks. What the switch does: when the parked blocks in PC memory have 1 GB or more free, and the free part is at least a third of what the blocks hold, the idle parked textures in them are let go, and emptied blocks give their shared memory back. Only blocks less than about a third full are emptied, so how much comes back depends on how many of your 54 blocks are that sparse. A texture that was let go is made again the next time it is used. It runs inside the existing texture compaction (`DARNER_COMPACT_SPARSE`, on unless set to `0`), and it works even when the PC has plenty of room. Without the switch, that compaction only touches the parked blocks when the PC is short of commit, short of shared room, under memory pressure, or low on host room, which I would not expect on 32 GB, but have not checked. Your ledger line meets the trigger: 1,707 MB free is more than 1,024 MB, and 1,707 x 3 is more than 3,456 MB. We have not run this ourselves, so I can't say how much it gives back on your run. Could you try one run with `DARNER_PARK_COMPACT_WASTE=1` on the same build and report: - the same memory lines at the end (the parked-blocks line and the shared-memory split); - the texture re-upload warnings per minute; - whether any textures show white. The thing to watch is the re-upload rate. Your `DARNER_POOL_TRIM=1` run went from 6.9 to 10.7 warnings a minute with a few white textures (and, as you noted, you did not check without the switch). If this switch does the same, that is worth knowing. If you can, a run with and without it on the same route would tell the two apart. ### Details for the maintainer - `README.md:744` (tag v2026.12.03.02): the `DARNER_PARK_COMPACT_WASTE` row. - `crates/darner-gpu/src/resource.rs` at v2026.12.03.02: `compact_plan` (about line 5341) sets `park_waste` when `park_holes` holds and the switch is on; `park_wasteful` (about line 5385) is `free >= PARK_WASTE && free * 3 >= held`; `PARK_WASTE` is 1 GiB; `park_holes` needs 512 MB or more free in the parked pools (`COMPACT_HOLES`). - `do_park` empties only blocks under 35% held (`COMPACT_SPARSE_PER_MILLE` 350, via `sparse_parked_blocks`, `pool.rs` about line 2365); your average is about 50% (1,739 of 3,456 MB live). - Without the switch, `do_park` needs `short_of_commit || park_tight`. - This is from reading the code and the issue text only. Not run, not measured. This post was written with AI assistance (Claude Code).
Author
Contributor

Thanks, both of you.

@Jesper-A: I missed DARNER_PARK_COMPACT_WASTE. I checked it at f3840d73 (resource.rs:5341-5392) and read it the same way. In the 41-minute baseline, the trigger (1 GB or more free, and at least a third of the blocks free) was first met about 28 minutes in, and held most of the time after about 35 minutes. So each test run needs about 40 minutes of open-world play.

Planned, not run yet: two runs of about 40 minutes on the same route, one without DARNER_PARK_COMPACT_WASTE=1 and one with it. For each, I'll post here:

  • the parked-blocks line and the shared-memory split at the end;
  • the texture re-upload warnings a minute;
  • whether any textures show white.

I'm on other runs first, so this will take a while.

@Cyber-Croissant: thanks for the numbers and the note on placed resources. Understood: #332's drain doesn't carry over to the park as it is, only its rule (the emptiest block, one at a time, when the others have room).

This post was written with AI assistance (Claude Code).

Thanks, both of you. @Jesper-A: I missed `DARNER_PARK_COMPACT_WASTE`. I checked it at `f3840d73` (`resource.rs:5341-5392`) and read it the same way. In the 41-minute baseline, the trigger (1 GB or more free, and at least a third of the blocks free) was first met about 28 minutes in, and held most of the time after about 35 minutes. So each test run needs about 40 minutes of open-world play. Planned, not run yet: two runs of about 40 minutes on the same route, one without `DARNER_PARK_COMPACT_WASTE=1` and one with it. For each, I'll post here: - the parked-blocks line and the shared-memory split at the end; - the texture re-upload warnings a minute; - whether any textures show white. I'm on other runs first, so this will take a while. @Cyber-Croissant: thanks for the numbers and the note on placed resources. Understood: #332's drain doesn't carry over to the park as it is, only its rule (the emptiest block, one at a time, when the others have room). This post was written with AI assistance (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
3 participants
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
TrustNo1/Darner#375
No description provided.