The error "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details." It always appears to me. I have tried to uninstall and install again, but nothing works for me.
The error "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details." It always appears to me. I have tried to uninstall and install again, but nothing works for me.
Do you mean installing PlayFabSDK on Unity? If so, what is the version of the PlayFabSDK and Unity you are working on? Can you please try upgrading to the latest version of PlayFabSDK?
My unity version is 2021.3.10f1 and my PlayFabSDK is 2.152.221010 (latest). No improvement after update.
I just installed unity jobs to read the full message:
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[]) PlayFab.PfEditor.PlayFabEditorHttp:MakeApiCall(String, String, GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:74) PlayFab.PfEditor.PlayFabEditorApi:GetStudios(GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorApi.cs:30) PlayFab.PfEditor.PlayFabEditorDataService:RefreshStudiosList(Boolean) (at Assets\PlayFabEditorExtensions\Editor\Scripts\Utils\PlayFabEditorDataService.cs:197) PlayFab.PfEditor.PlayFabEditor:OnEnable() (at Assets\PlayFabEditorExtensions\Editor\PlayFabEditor.cs:45) PlayFab.PfEditor.PlayFabEditor:OnFocus() (at Assets\PlayFabEditorExtensions\Editor\PlayFabEditor.cs:62) UnityEditor.HostView:RegisterSelectedPane(Boolean) UnityEditor.HostView:OnEnable() UnityEditor.DockArea:OnEnable()
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[]) PlayFab.PfEditor.PlayFabEditorHttp:MakeApiCall(String, String, GetTitleDataRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:74) PlayFab.PfEditor.PlayFabEditorApi:GetTitleData(Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorApi.cs:46) PlayFab.PfEditor.TitleDataViewer:RefreshTitleData() (at Assets\PlayFabEditorExtensions\Editor\Scripts\Components\TitleDataViewer.cs:122) PlayFab.PfEditor.PlayFabEditorDataMenu:DrawDataPanel() (at Assets\PlayFabEditorExtensions\Editor\Scripts\Panels\PlayFabEditorDataMenu.cs:38) PlayFab.PfEditor.PlayFabEditor:OnGuiInternal() (at Assets\PlayFabEditorExtensions\Editor\PlayFabEditor.cs:134) PlayFab.PfEditor.PlayFabEditor:HideRepaintErrors(Action) (at Assets\PlayFabEditorExtensions\Editor\PlayFabEditor.cs:172)
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[]) PlayFab.PfEditor.PlayFabEditorHttp:MakeApiCall(String, String, GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:74) PlayFab.PfEditor.PlayFabEditorApi:GetStudios(GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorApi.cs:30) PlayFab.PfEditor.PlayFabEditorDataService:RefreshStudiosList(Boolean) (at Assets\PlayFabEditorExtensions\Editor\Scripts\Utils\PlayFabEditorDataService.cs:197) PlayFab.PfEditor.<>c:<OnLoginButtonClicked>b__14_0(LoginResult) (at Assets\PlayFabEditorExtensions\Editor\Scripts\Panels\PlayFabEditorAuthenticate.cs:284)
PlayFab.PfEditor.PlayFabEditorHttp:OnWwwSuccess(String, Action`1, Action`1, String) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:124) PlayFab.PfEditor.<>c__DisplayClass2_0`2:<MakeApiCall>b__0(String) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:95) PlayFab.PfEditor.<Post>d__7:MoveNext() (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:179) PlayFab.PfEditor.EditorCoroutine:Update() (at Assets\PlayFabEditorExtensions\Editor\Scripts\Utils\EditorCoroutine.cs:103) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
I removed playfab editor extensions and it seems to have worked. I will write any news here. Thanks.
Currently there is some issue with using PlayFab Editor Extension in Unity new versions. But the PlayFab Unity SDK is still working.
The PlayFab Editor Extension isn't necessary to connect to the PlayFab service. You can remove it and use the PlayFab Unity SDK only.
Or you can fix the PlayFab Editor Extension yourself. Referring to this Unity forum case: A Native Collection has not been disposed, resulting in a memory leak. - Unity Forum
You can go to Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:74
and edit the code as
var www = new UnityWebRequest(url) { uploadHandler = new UploadHandlerRaw(payload), downloadHandler = new DownloadHandlerBuffer(), method = "POST" }; //Add these two lines www.disposeUploadHandlerOnDispose = true; www.disposeDownloadHandlerOnDispose = true;
then go to the Post function in the same file, change it to:
if (www != null) { yield return www.SendWebRequest(); if (!string.IsNullOrEmpty(www.error)) errorCallback(www.error); else callBack(www.downloadHandler.text); //Add this line www.Dispose(); } else { UnityEngine.Debug.Log("UnityWebRequest was null"); errorCallback("UnityWebRequest Object was null"); }
Will this get updated to playfab? I put it in, but if the sdk gets updated it gets reverted.
Hi! Also get this error. The full stack is: 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[]) PlayFab.PfEditor.PlayFabEditorHttp:MakeApiCall(String, String, GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorHttp.cs:85) PlayFab.PfEditor.PlayFabEditorApi:GetStudios(GetStudiosRequest, Action`1, Action`1) (at Assets\PlayFabEditorExtensions\Editor\Scripts\PlayFabEditorSDK\PlayFabEditorApi.cs:35) PlayFab.PfEditor.PlayFabEditorDataService:RefreshStudiosList(Boolean) (at Assets\PlayFabEditorExtensions\Editor\Scripts\Utils\PlayFabEditorDataService.cs:197) PlayFab.PfEditor.PlayFabEditor:OnEnable() (at Assets\PlayFabEditorExtensions\Editor\PlayFabEditor.cs:45)
Rick Chen's solutions works.
19 People are following this question.