0 votes

If you attempt to call a function on a previously freed Object you get something like this as an error:

Attempt to call function 'get_collision_point' in base 'previously freed instance' on a null instance.

If the instance no longer exists in memory, it seems they are replaced by "new" instances of something akin to a "record" of previously freed nodes.

This is great for debugging, but what if I want to remove something from memory, and all records that it ever existed? What's wrong with a good old segmentation fault? Otherwise, some projects will be forced to leak some memory in the engine.

Are these Objects truly free when the executable runs?

Godot version 3.4.2
in Engine by (57 points)

1 Answer

+1 vote
Best answer

Nodes are entirely freed. Only references to them, before becoming null, are replaced into this specific value type of "freed node". This doesn't use any significant amount of memory, You can think of it as a "metadata of null". All properties of object, as well as RID, are gone.
I don't think it is possible to design a freeing system, that automatically removes all hard references thruoghout whole code.

by (7,925 points)
selected by
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.