- Home /
Firebase garbage collection bug, trigger GC manually ? ,Firebase garbage collection bug, trigger GC manually
Current Firebase Sdk (5.5.0) has a garbage collection bug. They know this issue and they have a temporary solution.
https://github.com/firebase/quickstart-unity/issues/191
To summarize, @chkuang-g discovered a general issue with garbage collection across the SDK. If you create an object release the reference then create effectively the same object (e.g the same database reference) again it's possible for the SDK to end up with two C# objects, one in the garbage collection queue and the other held by the application, pointing at the same C++ object. When the object in the garbage collection queue is finally deleted, it also deletes the C++ object and we end up with a C# object referencing a stale pointer to a C++ object. @chkuang-g is working on a fix at the moment. In the meantime, you should keep references around to objects that are reused on a regular basis in your application.
This problem also cause unity crash if you play and stop constantly without waiting for GC. For example if I close the unity completely after a session. And reopen again there is no problem. So I would like trigger GC manually, and simulate like closing the unity. But I could't do this. Looks like GC.Collect() doesn't change anything.
Probably they will fix the problem on next releases. Until that fix, I need to solve the problem manually.
Does anyone know, calling GC manually ?