Skip to content

WIP: Buffer cache: run LRU GC pass when memory threshold is exceeded#4107

Draft
collinmcg wants to merge 3 commits intoshadps4-emu:mainfrom
collinmcg:jane/buffer-gc-run
Draft

WIP: Buffer cache: run LRU GC pass when memory threshold is exceeded#4107
collinmcg wants to merge 3 commits intoshadps4-emu:mainfrom
collinmcg:jane/buffer-gc-run

Conversation

@collinmcg
Copy link
Copy Markdown

@collinmcg collinmcg commented Mar 7, 2026

While checking stutter-related paths, I noticed BufferCache::RunGarbageCollector() was effectively a no-op under pressure.

It calculated thresholds and built a cleanup lambda, but never actually walked the LRU list, so nothing got reclaimed.

This patch does the minimal thing:

  • run lru_cache.ForEachItemBelow(gc_tick - ticks_to_destroy, clean_up)
  • make the lambda return bool so we can stop after max_deletions

No refactor or behavior changes outside this GC path.

Validation:

  • verified call path from Rasterizer::OnSubmit() to RunGarbageCollector()
  • local configure succeeds
  • full local build still fails in unrelated external code (externals/openal-soft) in this environment
  • checked compile of modified TU with compile commands (buffer_cache.cpp)

@red-prig
Copy link
Copy Markdown
Contributor

red-prig commented Mar 7, 2026

Now run tests without using AI on real games and look for differences and regressions.

@collinmcg collinmcg changed the title Buffer cache: run LRU GC pass when memory threshold is exceeded WIP: Buffer cache: run LRU GC pass when memory threshold is exceeded Mar 7, 2026
@collinmcg collinmcg marked this pull request as draft March 7, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants