Profiler Question, Memory leak C#?

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

I see the “Static memory” number going up the entire time my game is running, particularly from mouse move events being generated.
It’s just a C# class that has _Input function.

Am I understanding the profiler wrong?
If not, how does this memory get freed?
Calling GC.Collect doesn’t seem to do anything, so does that mean the input event objects are still referenced somehow?

We would need to see actual code here. If you are using something that inherits from Node or Object, you may be leaking those. Nodes are only managed as long as they are in the tree. Godot.Objects subclasses are not managed at all unless you inherit from Reference, which is ref counted. There are lot of caveats around ‘WeakRef’. I would need to see the code to actually, help, though. If all else can be ruled out, then there may be a bug.

Aristonaut | 2020-05-28 02:25