Tiled not unloading files stored in RAM
Describe the bug While loading a large sum of image files, I noticed memory usage had hit 90%+ and so closed the file i was currently working on. Memory usage did not change.
To Reproduce Steps to reproduce the behavior:
- Load large amount of files
- Open Task Manager, or similar system viewer
- Close Tab with large amount of files
- Observe memory usage not changing
Expected behavior Expected memory usage to decrease when closing tab and deloading the images.
Media N/A
Specifications:
- OS: Windows 11
- Tiled Version: 1.11.0
You closed the tab of the file, but did you make sure the file wasn't actually used by some other document, and therefore still loaded? Tilesets remain loaded if they're included in any open map, and I think Maps remain loaded if their World is loaded.
I think Assets also remain loaded for the purposes of Reopen Closed File, so it may take a couple of file closures to actually remove them.
I havent used any of the assets yet so the tiles shouldnt be used elsewhere. I understand the reopen closed tab part, but from further testing, memory usage seems to increse slightly upon closing a tab
Currently the image cache used by Tiled indeed never gets cleared, so if Tiled eats lots of memory due to having loaded many images, the only way to reduce memory usage is by restarting Tiled.