mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.21k stars 1.76k forks source link

Tiled not unloading files stored in RAM #4063

Open cowardlycamper32 opened 1 month ago

cowardlycamper32 commented 1 month ago

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:

  1. Load large amount of files
  2. Open Task Manager, or similar system viewer
  3. Close Tab with large amount of files
  4. Observe memory usage not changing

Expected behavior Expected memory usage to decrease when closing tab and deloading the images.

Media N/A

Specifications:

eishiya commented 1 month ago

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.

cowardlycamper32 commented 1 month ago

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

bjorn commented 1 month ago

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.