I’m accumulating orphans throughout the game, and I would like to free them. I was able to find a lot of places in my code where a orphan node was generated and then I was able to queue_free(). Unfortunately, print_orphan_nodes() doesn’t give more than this information:
This post includes an example that uses an autoload singleton. Basically if you have nodes that you are worried about being orphaned, they need to inherit from a script class that can listen to a signal queue_free() them. I’m not aware of any other blanket method like that.
Otherwise I might recommend looking at why your nodes are being orphaned in the first place, and putting in logic to free them instead. Memory leaks suck!
I think I found a way to discover all your orphans. In the main scene of your game (the last one to be exited from the tree), connect the signal tree_exiting and include the method print_orphan_nodes(). Now, run the game and close it whenever you feel you have the number of orphan nodes that you want to be aware of.