Hi all, for my game i want to create / erase scenes continuously, so I got inspired by an open source project : 2 taps racer link1 and source code.
I thought the cleanup was perfect, however after running my game for a while, I noticed the memory kept on increasing and eventually (after hours) crashed with the following error :
ERROR: alloc: Method/Function Failed, returning: INVALIDID
At: core/os/memorypooldynamicstatic.cpp:81.
Segmentation fault (core dumped)
I am using Godot v 2.1 but 2 taps racer uses v2.2, so i managed to run it in Godot 2.2 and noticed that also it leaked ! (I don’t remember the exact numbers but around 37 MB start to 50.1 MB after 2 hours under linux)
I used the following combinations with no perfect deallocation (memory kept increasing):
- lastChild.free()
- lastChild.queue_free()
- rootDynamicelement.remove_child( lastChild )
- rootDynamicelement.remove_child( lastChild ) AND lastChild.free()
PS: rootDynamicelement is the element i adding and removing scenes as children.
lastChild is the node (scene) to be removed from the rootDynamicelement
I did check the following links from this forum, but can't seem to solve my problem:
How force resource to free?
Large number of objects not cleaned up properly
Can anyone shed any light on this ? Is this a known bug in Godot or am i missing
some trivial step for correct cleanup ?
Thx in advance !
PS: I am using purely GDScript as language