ldtk
ldtk copied to clipboard
fix: cache level json data on temporary files to avoid memory issues
This PR fixes https://github.com/deepnight/ldtk/issues/1172.
When loading projects which are bigger than usual (~40 levels) the level json caching mechanism allocates a lot of memory and requires more than 4GB of memory, which blocks the editor.
The change (differently to #1176) uses temporary files to keep the memory usage low and at the same time avoids to disable the caching altogether.
The temporary files are deleted on cache invalidation so also on project tidy at closure so no residual files should remain after projects are closed.
Please review and send feedback.