Hi,
I'm using Unity 2020.3.18f1 with PlayFab SDK Version 2.113.210830 to create a little iOS game.
I noticed that after a certain time, the iPhone reports that the app is using too much memory and thus will be closed.
Looking via XCode instruments and Unity profiler, I can see, that the native memory skyrockets after some time that leads to closing the app. But only Xcode reports that the memory skyrockets, but not the Unity profiler, so it has to be something native.
I tried to tackle the issues to find out, where it comes from. I figured out, that certain requests using PlayFab seem to start the memory leak, so I was taking a look into the code.
The "normal" SDK methods will use the MakeApiCall-method to communicate with the PlayFab-API: https://github.com/PlayFab/UnitySDK/blob/master/ExampleMacProject/Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs#L105
It starts a Coroutine called "Post".
At the very end of this Post-Method you can see, that the UnityWebRequests gets disposed: https://github.com/PlayFab/UnitySDK/blob/master/ExampleMacProject/Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs#L164
So far, so good.
But, in my game I'm using SimplePutCall to upload something to the server.
However, as you can see here: https://github.com/PlayFab/UnitySDK/blob/master/ExampleMacProject/Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs#L61
An instance of UnityWebRequest will be created, but you will NOT see any "request.Dispose()" at the end of the method.
If I add a request.Dispose() at the end, the memory leak seems to be resolved.
Could it be, that in the Unity SDK this request.Dispose() was forgotten, thus never releasing the native memory that is allocated by UnityWebRequest?