Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | supaiku | |
Old Version | Published before Godot 3 was released. |
Hi,
I ported a fairly large JavaScript codebase to GDScript. With JavaScript I never bothered, because the GC took care of everything.
Now in Godot I noticed, that only a fraction of all allocated objects are released. The Debugger/Monitor initially says 1000 objects. When I enter a certain scene it goes up by another 1k. Upon leave it should go down by 1k, but instead only removes like 200. I can repeat this step endlessly and make my game eat memory like crazy.
All my objects are References. I have no clue how I go and find out which references are being kept alive in memory. Though, that would help me enormously.
I’m also sure that I set all refs to null, before leaving the scene. So… how can I find out what keeps living in memory?
Thanks in advance.
Uh… Nevermind. I missed a line and it has never been cleaned up at all. Now I’m down to 18 remnants. Questions stays somewhat relevant… I’m curious how to identify them.
supaiku | 2016-08-02 00:30
What is the inverse function of queue_free() ?
I need to reinstance my parent so that I can add all its children later
Pedro Karut Gimenez | 2016-08-03 18:24
There’s no such thing as an inverse function of queue_free. This method tells the engine to destroy and erase permanently the node. Once you call it, the node is dead, gone forever.
If you want to reuse a node, don’t free it. Just remove it from its parent. Then add it again when you need it back.
Gokudomatic2 | 2016-08-04 16:01