- Home /
How to solve "A Native Collection has not been disposed, resulting in a memory leak." in my case?
Hello everyone,
after finally switching my project to Unity Version 2021, I often got this message in the console:
A Native Collection has not been disposed, resulting in a memory leak.Enable full stacktraces to get more details.
I managed to enable that by importing com.unity.entities and now the console looks like this:
A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator) UnityEngine.Networking.UploadHandlerRaw:.ctor(Byte[]) UnityEngine.Networking.UnityWebRequest:SetupPost(UnityWebRequest, WWWForm) UnityEngine.Networking.UnityWebRequest:Post(String, WWWForm) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) System.Reflection.MethodBase:Invoke(Object, Object[]) Google.PortableWebRequest:StartRequest(HttpMethod, String, IDictionary`2, WWWForm) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/PortableWebRequest.cs:481) Google.c_AnonStorey6:<>mC() (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/PortableWebRequest.cs:443) Google.RunOnMainThread:ExecuteNext() (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:486) Google.RunOnMainThread:m_12() (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:536) Google.RunOnMainThread:RunAction(Action) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343) Google.RunOnMainThread:ExecuteAllUnnested(Boolean) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530) Google.RunOnMainThread:ExecuteAll() (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
The message appers sometimes even multiple times in the console. Unfortunatly that doesn't help me. Can anyone tell me what to do now?
Answer by andrew-lukasik · Jul 27, 2021 at 04:35 PM
Google.PortableWebRequest:StartRequest(HttpMethod, String, IDictionary`2, WWWForm) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/VersionHandlerImpl/src/PortableWebRequest.cs:481)
These are the droids you're looking for:
You can modify this source code to intercept that unityRequest
, interrogate it, investigate possible causes and fix it on the spot.
Your answer
![](https://koobas.hobune.stream/wayback/20220613040848im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Version Not Installed? 1 Answer
Failed to update unity Web Player 2 Answers
Finding the version of unity player used 2 Answers