Looking at where the error refers to… https://github.com/godotengine/godot/blob/master/core/self_list.h
…my guess is that one or more of my GDScript files are still in use when the game exists, so the list keeping track of them can’t completely free its resources.
Can anyone shed some light on this and help me understand these errors?
Thanks in advance!
ERROR: ~List: Condition “_first != __null” is true.
At: ./core/self_list.h:112
Should this not be a warning??
still exists in 3.2.3 and yes I load the resources. shows up in executable on windows.
I don’t always have the scene that created the instance so when exiting tree they have to be located … so ignoring this is not ok … how do we hide this?
docs show
func _exit_tree():
# When the node exits the Scene Tree, this function is called.
# Children nodes have all exited the Scene Tree at this point
# and all became inactive.
pass
crazyhat62 | 2020-09-26 07:32
Hey, i had the same problem with memory leaks. my problem was that I was instancing the node but not adding to the scene tree. I have a habit of making dictionaries instead of if/else statements like:
The dictionary is wrong because i instance 2 objects, but i am only using one of them; when i close the game, that unused object will leak. I fixed it by just wring the absolute path in the dic and instancing the object that i actually use.
The best way to find these problems is to use --verbose. You do so by going to your computer’s cmd and writing the absolute path of you godot + the application.exe and adding space follow by the --verbose keyword. like this:
C:\Users\name\> cd C:\Users\name\deskstop\godot.v3.3.exe --verbose
OK, so I think the errors are the editor’s way of complaining that there were resources, in general, which were not freed upon exiting the application.
For instance, doing something like…
var local_scene = null
func _ready():
var resource = load("res://MyScene.tscn")
local_scene = resource.instance()
# Ignore responsibility for freeing 'local_scene'
func _exit_tree():
pass
…seems to trigger the two errors. But it can be resolved by calling .free() on the variables using instanced resources:
func _exit_tree():
local_scene.free()
Additionally, it seems like .queue_free() might NOT work in some cases. I will update my findings when I learn more.
Any comments, corrections, or feedback in the meantime would be appreciated.