Astrabit-ST / Luminol

An RPG Maker XP-VX Ace rewrite, written in Rust with love 💕
https://luminol.dev/
GNU General Public License v3.0
95 stars 11 forks source link

Cache eviction #103

Closed white-axe closed 4 months ago

white-axe commented 4 months ago

Description This pull request clears the atlas cache and texture cache when unloading projects. Not unloading these caches when unloading projects causes maps to display incorrectly if you load a map in a project that has a tileset with the same ID as a tileset in a previously opened project and also results in memory leaks when opening a lot of projects without closing Luminol.

I also noticed that Rust wasm32-unknown-unknown builds with atomics support only have access to 1 gibibyte of memory by default. In practice, the available amount of memory is usually less than half of that because of how dynamic memory allocation works, so I raised the maximum memory in web builds to 4 gibibytes (the maximum for wasm32 and other 32-bit architectures) to prevent cached resources like database entries and loaded audio files from overrunning the memory.

Testing When loading a map in one project and then loading a map in a different project with the same tileset ID as the first map's tileset ID without closing Luminol, the map in the second project should now use the correct tileset instead of using the first map's tileset.

Checklist