Hello everyone,
I'm having some wierd issues while trying to fix my memory leaks. Im using a Dictionary with weak keys to keep track of all objects that are in my game, combiner with a force garbage collection and printen whatever isnt null afterwards.
I've stumbled on the following issues, objects that have their functions passed to Multiplayer.joinRoom as callbacks, are not GC'd
In my case i have a Class JoinRoomAlgo, which will pass 2 of its own functions when trying to connect. When later i undo the connection, i do connection.Disconnect() and remove all References to both the JoinRoomAlgo instance, and the connection object itself.
However both persist in memory.
I've trying looking at any and every spot that could somehow still have a reference to these objects, but there simply isnt any. Thus i've come to the conclusion that Player.IO might be doing something wrong.
To proof that I do not have a lingering reference to JoinRoomAlgo, i even make a temporary object BEFORE using joinRoom. This object has the 2 callbacks and a reference to the JoinRoomAlgo. the callbacks simple pass on the parameters to the ACTUAL callbacks on JoinRoomAlgo, and then set the reference to the object to null. The temporary object will stay in memory, while the JoinRoomAlgo instance will now propperly be collected.
Does anyone have a propper solution for this?