vk_pipeline_cache: Fix unbounded memory growth during shader compilation #134

Merged
Collecting merged 1 commit from fix-unbounded-memory into main 2026-02-11 15:21:31 -05:00
Collaborator

Previously, the emulator would only evict old shader pipelines from RAM when the GPU's VRAM was exhausted (VK_ERROR_OUT_OF_DEVICE_MEMORY).

This caused a significant memory leak on systems with ample VRAM but limited system RAM, as the shader cache could grow indefinitely during gameplay, leading to OOM crashes.

This commit introduces a hard limit (MAX_PIPELINES_IN_RAM = 4096) on the number of pipelines kept in host memory. When this limit is reached, EvictOldPipelines() is triggered proactively to free up resources, ensuring stable memory usage.

Previously, the emulator would only evict old shader pipelines from RAM when the GPU's VRAM was exhausted (VK_ERROR_OUT_OF_DEVICE_MEMORY). This caused a significant memory leak on systems with ample VRAM but limited system RAM, as the shader cache could grow indefinitely during gameplay, leading to OOM crashes. This commit introduces a hard limit (MAX_PIPELINES_IN_RAM = 4096) on the number of pipelines kept in host memory. When this limit is reached, EvictOldPipelines() is triggered proactively to free up resources, ensuring stable memory usage.
Collecting force-pushed fix-unbounded-memory from 65280c707c to dca10aff6b 2026-02-11 15:20:58 -05:00 Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
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
Kintoki/Emulator!134
No description provided.