Fix XMB thumbnail memory exhaustion on low-memory devices#18854
Fix XMB thumbnail memory exhaustion on low-memory devices#18854ma-moon wants to merge 1 commit intolibretro:masterfrom
Conversation
…roll detection, frees textures. Fixes libretro#6747
|
This is the clean, rebased version of #18828.
Ready for merge. Please review when you have time. Thanks! Best, |
|
All CI checks are green. No merge conflicts. Please merge when you have time. Thanks! Best, |
1 similar comment
|
All CI checks are green. No merge conflicts. Please merge when you have time. Thanks! Best, |
|
CI passed, ready for review. Could you take a look when you have time? Thanks! |
There was a problem hiding this comment.
Would it make sense to apply this beyond XMB? The other themes load thumbnails too, maybe they'd apply?
| #if defined(HAVE_OPENGLES) || defined(__SWITCH__) || defined(ANDROID) | ||
| /* Low-memory platforms: limit to 2 concurrent loads */ | ||
| gfx_thumbnail_set_max_concurrent_loads(2); | ||
| #else | ||
| /* Desktop platforms: allow 4 concurrent loads */ | ||
| gfx_thumbnail_set_max_concurrent_loads(4); | ||
| #endif |
There was a problem hiding this comment.
Hardcoding 2 vs 4 indicates it could likely live better as a defined macro that could be changed during compilation flags.
#ifndef GFX_THUMBNAIL_MAX_CONCURRENT_LOADS
#define GFX_THUMBNAIL_MAX_CONCURRENT_LOADS 4
#endif| /* LOW-MEMORY FIX: Maximum number of concurrent thumbnail load tasks | ||
| * Helps prevent memory exhaustion on low-memory devices (RPi, Switch, etc.) */ |
There was a problem hiding this comment.
Writing LOW-MEMORY FIX everywhere is unnecessary.
| /* LOW-MEMORY FIX: Maximum number of concurrent thumbnail load tasks | |
| * Helps prevent memory exhaustion on low-memory devices (RPi, Switch, etc.) */ | |
| /* Limits the number of thumbnails that can be loaded concurrently. | |
| * Helps prevent memory exhaustion on low-memory devices (RPi, Switch, etc.) */ |
| /* LOW-MEMORY FIX: Concurrent load management API */ | ||
|
|
There was a problem hiding this comment.
Not needed. It's covered in the doxygen docs of the function definitions.
| /* LOW-MEMORY FIX: Concurrent load management API */ |
|
Hi maintainers, I am the original author of #18828 and have re-submitted a clean version as #18854. I have resolved the conflicts and removed unrelated files as requested. Please review this PR. I would like to formally claim the bounty for #6747. Let me know if there's anything else I need to fix. Thank you. |
|
Please be aware that mentioned bounty has been set up via bountysource where the backend company has gone out of business without paying since years, so the funds are lost and claiming it will not be possible. |
|
@RobLoach Good point. I can create a separate PR for ozone/rgui after this one is merged. This PR focuses on XMB only. |
|
@RobLoach Fixed. Changed to #ifndef GFX_THUMBNAIL_MAX_CONCURRENT_LOADS with default 4. |
|
@RobLoach Removed the redundant "LOW-MEMORY FIX" comments. Cleaned up as suggested. |
|
@RobLoach @libretro/maintainers All review comments have been addressed. PR is ready for another look. Thanks! |
Description
This PR fixes severe memory exhaustion issues in the XMB menu when loading thumbnails on low-memory devices (e.g., embedded systems, older phones).
This is a cleaned-up version of the changes originally proposed in #18828, squashed into a single commit based on the latest master.
Changes
Related Issue
Fixes #6747
Testing
Tested on low-memory environments; verified stable memory usage during rapid scrolling and large library navigation.