Possible memory leak? Object count climbing causing lag

Godot Version

4.3 Beta 1

Question

I am currently expirementing with Multiplayer games in 4.x

I am using Synchronizers and Spawners for my entities but for some reason my Object counter is constantly increasing.


Server isnt increasing but i cant find any recoursion occuring in my code that would cause an object to be created over and over.

Testing it seems to be when I add any weapon object and set the current_weapon variable to that object.

More Context it is a shooter game with basic primary, secondary, knife objects these are added by the server using the spawners and the properties for these weapons are set by a general weapon manager script that is where the current weapon variable is located

My guess is you are creating objects somewhere that have strong reference cycle between them, causing the memory leak.

If you have your project in Git, maybe try to backtrack in your commits to the point where the leak first appears and then look at what changed.

Thank you for your suggested I didnt know when the leak occurred but after going through my git and testing my commits found out i was calling a resetSpray function that was generating the objects and not clearing them. Thank you!!!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.