Godot doesn't free memory, why?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Guliver_Jham

I checked through all my code and there isn’t a single reference to the current scene or anything in it outside (like in a singleton node), yet i see in task manager that when i change scene to a empty one with only the player & the camera, no memory is freed, and even more ends up being used. Do you have any idea what could be causing this?

What version of Godot? What OS?

jgodfrey | 2020-08-25 20:18

The godot version is the 3.2.2 mono 64 bits. (i only use godotscript tho)

The OS is windows 7 64 bits.

Guliver_Jham | 2020-08-25 20:27

Hmmm. I thought maybe you could be experiencing this, which seems similar…

https://github.com/godotengine/godot/issues/19300

Though, that’s assumed to be fixed in 3.2.x I think.

jgodfrey | 2020-08-25 20:42

Yeah, it wasn’t fixed apparently, i tested and when i jumped to a scene with nothing, nothing rly, only the “node2d” i discovered that the problem just increases, memory usage jumped for… like 2000k and i verified now, this extra memory is still not being freed.

Guliver_Jham | 2020-08-25 21:15

One more detail: my project has a node called “master”, a singleton node that holds the reference for the current camera and player upon loading a scene, hoever before changing a scene sets these references to null to prevent problems.

Guliver_Jham | 2020-08-25 21:20

Hi,
have you checked the Debugger monitor for orphaned objects or resources that still resite?

klaas | 2020-08-25 21:36

I checked and nothing popped up.

But now i know one of the sources of the problems, and it’s really bizarre and nonsensical, but without a doubt that was it.

When i looked at the profiler an unused class method from an unused resource popped up to execute: “a1”.

This is strangely nonsensical because all methods that instantiated\executed this script were scrapped at the botton of the script and were never called. Only the thing that loaded the script were called 1 time initializing, but that’s about it, it didn’t instantiate it or anything and it couldn’t be instantiated.

So what i did was delete the old methods and the resources & the thing that instantiated the script.

BOOM, -1800K when i loaded the empty scene.

WHAT

Guliver_Jham | 2020-08-25 23:16