This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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/memory
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.queue_free()
  • rootDynamicelement.remove_child( lastChild )
  • rootDynamicelement.remove_child( lastChild ) AND

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

in Engine by (895 points)
edited by

So I created a test scene, using the desert one from 2 taps racer, added 2D Panels, and I have no leaks at all... Not sure what was causing it but it certainly was something from my scene setup.

Will update this thread in case i nail it for sure.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.