Quick answer: Pygame's automatic image cache growing unbounded with many distinct loads? No automatic eviction - manage cache manually.

Long session loads 5000 unique images; memory hits 4GB; OOM.

Manual cache

Per-image LRU cache. Evict least-recently-used when full.

Or pre-load on level start

Load all images for the level; unload at level end.

Profile cache size

Per-frame cache memory. Growth = leak.

“Pygame doesn't auto-evict. Cache management is yours.”

Build a Sprite Manager. Loaded sprites tracked; evicted at level transitions. Memory bounded.

Related reading