unity-wakatime icon indicating copy to clipboard operation
unity-wakatime copied to clipboard

Fix native collections leak on Unity v2021+

Open JayPeet opened this issue 3 years ago • 5 comments

Dispose was not called on the UnityWebRequest, which in newer versions of unity causes a memory leak.

disposeUploadHandlerOnDispose defaults to true, so it will also implicitly dispose that class. This is backwards compatible to unity 2018, when the UnityWebRequest class was introduced, as it has always implement IDisposable (see: https://github.com/Unity-Technologies/UnityCsReference/blob/2018.1/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs)

JayPeet avatar Nov 19 '21 18:11 JayPeet

~~Actually. I don't think this fully fixes the issue. Investigating~~

False alarm, I was seeing errors relating to it from previous runs of the plugin.

JayPeet avatar Nov 19 '21 18:11 JayPeet

Actually, this sometimes still has the issue.

I'll look into it some more

JayPeet avatar Nov 21 '21 22:11 JayPeet

Is this going to be merged? I would love to see this bug fixed.

vanBassum avatar Jun 06 '22 13:06 vanBassum

I would love to, but it ended up not fully fixing the issue. I haven't had time to come back and resolve it :(

JayPeet avatar Jun 06 '22 13:06 JayPeet

I can confirm that on my machine this fixed the problem. It also wouldn't allow me to build before when I had the bug.

maxtyson123 avatar Aug 10 '22 08:08 maxtyson123