Skip to content

[MemoryManagement] Optimize texture management and release strategy for web overlay to prevent GPU memory issues - #1384

Merged
Huevos merged 1 commit into
OpenViX:Developerfrom
DimitarCC:egl-mem-leak-fix
Oct 27, 2026
Merged

Huevos merged 1 commit into
OpenViX:Developerfrom
DimitarCC:egl-mem-leak-fix

Conversation

@DimitarCC

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to GPU memory management for GUI and web overlay textures, aiming to make texture eviction more predictable and to avoid sudden stalls or out-of-memory errors, especially when sharing GPU resources with a web browser (HbbTV). The changes implement a soft texture budget, allow for gradual eviction of textures, and add new controls for when and how web overlay textures are released.

Texture budget and eviction improvements:

  • Added a soft texture budget (ENIGMA_TEX_BUDGET_MB), which can be set via environment variable or is learned automatically after the first out-of-memory event; this budget governs how many textures are kept in memory, and textures are now released gradually over multiple frames instead of all at once. [1] [2] [3] [4] [5]
  • Modified the evictLRU and trimTo methods in gTextureManager to accept a max_count parameter, limiting how many textures are deleted per frame to avoid UI stalls. [1] [2] [3] [4]

Web overlay texture lifecycle management:

  • Introduced a callback (setOnShow) that is triggered before the web overlay becomes visible, ensuring that cached GUI textures are released to free up GPU memory for the browser. [1] [2]
  • Implemented logic to keep web overlay textures alive for a configurable grace period (ENIGMA_WEB_OVERLAY_IDLE_MS) after the overlay is hidden, releasing them when idle to reclaim GPU memory efficiently. [1] [2] [3] [4]

Web overlay upload modes and robustness:

  • Added a new "destroy" upload mode (ENIGMA_WEB_OVERLAY_UPLOAD=destroy) that deletes the previous frame's texture and waits for the GPU to finish before allocating a new one, ensuring minimal GPU memory use by the overlay. [1] [2] [3]

These updates collectively make texture management more robust and responsive, particularly in environments where GPU memory is shared between the GUI and web browser layers.

@Huevos
Huevos merged commit 7a481ab into OpenViX:Developer Oct 27, 2026
1 check passed
@DimitarCC
DimitarCC deleted the egl-mem-leak-fix branch October 28, 2026 14:49
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