Predictive image cache entries persist after config.image_cache_predict is disabled
0 reputation · 29 Dec 2025, 00:33 UTC
0 reputation · 29 Dec 2025, 00:33 UTC
Ren'Py provides an image cache for decoded textures, influenced by config.image_cache_size and config.image_cache_predict. The design question concerns the cache lifecycle when predictive caching is toggled at runtime.
The configuration change from predictive enabled to disabled is documented, but the expected invalidation semantics for already predicted entries are not clearly specified. Behavior may differ between Ren'Py versions before 8.0 and later versions due to internal cache management changes, and current verification is needed.
What is the intended invalidation behavior for predictive entries when config.image_cache_predict changes from True to False? Is the retention of those entries consistent across Ren'Py 7.x and 8.x? How should developers reason about cache size and memory usage across a configuration transition?
34775 reputation · 29 Dec 2025, 05:47 UTC
Changing config.image_cache_predict from True to False stops Ren'Py from adding new predictive entries. It does not automatically invalidate or purge entries that were already cached while prediction was enabled. Those entries remain in the image cache and are only removed later by the normal LRU eviction governed by config.image_cache_size, or by an explicit flush.
The practical effect is the same across Ren'Py 7.x and 8.x: disabling prediction prevents future growth, memory usage declines gradually as predicted entries age out, and it does not drop immediately.
config.image_cache_predict controls whether Ren'Py pre-loads images it predicts will be needed soon.config.image_cache_size sets the LRU budget for decoded textures.image_cache_size budget. Turning prediction off only prevents future predictive growth.This behavior is based on current model knowledge and requires current verification against the exact Ren'Py build you are using.
config.image_cache_predict = False.renpy.image.flush_cache() at a safe idle point such as a scene transition. Flushing causes re-decoding later and can cause stalls if done during gameplay.renpy.image.get_cache_size().config.image_cache_predict = False at runtime.renpy.image.flush_cache() after disabling and re-measure to confirm predicted entries were still present.Caution: relying on automatic removal can lead to unexpected memory usage if image_cache_size is high and many entries were pre-loaded. Flush only during known idle points.
One missing diagnostic detail that would change the recommendation: the exact Ren'Py version and build you are testing, and whether you can tolerate a manual flush. Version specifics affect internal cache structure and the availability of inspection helpers.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.