heroiclabs / nakama-unity

Unity client for Nakama server.
https://heroiclabs.com/docs/unity-client-guide
Other
411 stars 75 forks source link

Memory leak with UnityWebRequestAdapter? #120

Closed msklywenn closed 3 years ago

msklywenn commented 3 years ago

Since updating to 3.1.1 and/or using UnityWebRequestAdapter so that WebGL builds work, I have been randomly getting this error message: A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.

Unfortunately, enabling full stack traces everywhere still wouldn't give me a callstack...

I searched the code for a bit and I think I nailed it down to a UnityWebRequest in UnityWebRequestAdapter not being Disposed. I just added www.Dispose(); to the end of the SendRequest coroutine and all seems fine now. I'm not exactly sure if that is the right spot though.

lugehorsam commented 3 years ago

Thanks for catching this @msklywenn. I've resolved this in master (https://github.com/heroiclabs/nakama-unity/commit/657a6a3dbd4519c9f95842075f71ed75e4e49ff1) and will incorporate it into the next release.

unnanego commented 2 years ago

I'm getting this after updating to the latest version (3.4.1)