UnitySDK icon indicating copy to clipboard operation
UnitySDK copied to clipboard

A Native Collection has not been disposed, resulting in a memory leak (PlayFabUnityHttp.cs)

Open IanMoroney opened this issue 3 years ago • 1 comments

Fixes:

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.Internal.<Post>d__12:MoveNext() (at Assets\Libs\PlayFabSDK\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs:116)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
UnityEngine.MonoBehaviour:StartCoroutineManaged2(MonoBehaviour, IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PlayFab.Internal.PlayFabUnityHttp:MakeApiCall(Object) (at Assets\Libs\PlayFabSDK\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs:106)
PlayFab.Internal.PlayFabHttp:_MakeApiCall(String, String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, Boolean, PlayFabAuthenticationContext, PlayFabApiSettings, IPlayFabInstanceApi) (at Assets\Libs\PlayFabSDK\Shared\Internal\PlayFabHttp\PlayFabHTTP.cs:228)
PlayFab.Internal.PlayFabHttp:MakeApiCall(String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, PlayFabAuthenticationContext, PlayFabApiSettings, IPlayFabInstanceApi) (at Assets\Libs\PlayFabSDK\Shared\Internal\PlayFabHttp\PlayFabHTTP.cs:133)
PlayFab.PlayFabClientAPI:WritePlayerEvent(WriteClientPlayerEventRequest, Action`1, Action`1, Object, Dictionary`2) (at Assets\Libs\PlayFabSDK\Client\PlayFabClientAPI.cs:2244)

The www call is being Disposed at the bottom of the class, but still results in this memory leak. using solved the problem for us.

IanMoroney avatar Jun 29 '22 09:06 IanMoroney

We have added this change to the SDKGenerator. It should appear in the next PlayFab release.

toddbellMSFT avatar Jul 11 '22 19:07 toddbellMSFT

This should now be in the latest version of the Unity SDK. Thank you for the contribution.

toddbellMSFT avatar Oct 20 '22 23:10 toddbellMSFT