My game needs to load certain types of characters quickly and, as you know, loading them from disk every time can be a problem, at least in terms of performance.
But Godot has his own solutions called "Resource" (the class I mean). So if I have a reference to a Resource object and ask to load it again from disk, under the hood Godot just makes a copy of that into memory, making the process much faster.
Okay. Let's think about how to exploit this behavior... I created a Dictionary where the keys are the path to the scenes and the values are the Resource object referring to those scenes.
When the game starts, I load all these resources I need with the ResourceLoader by storing the references in that dictionary. It works very well! I can instantiate hundreds of items without any kind of FPS loss... Great!
When I close the game, unfortunately I get a lot of "Leaked Instance" and "Resource still in use" error messages in the log. I'm sure the problem comes from that dictionary because if I disable the lines of code that create it, these errors go away.
It seems that the resources I load aren't freed properly before closing the game, but the resource manual says this process is automatic. Also consider that, before closing the game, I delete the references to the loaded resources from the dictionary simply using its clear() method...
In your opinion, where is the problem?