Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Bug: A Native Collection has not been disposed, resulting in a memory leak

Discussion in 'Unity Cloud Diagnostics' started by Falondrian, Sep 22, 2022.

  1. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    72
    Unity 2021.3.10, latest User Reporting SDK

    It looks like the SDK hooks event handlers to webrequests but doesn't unhook them when the webrequest is done. I get the following error from time to time in the console:

    [Error] A Native Collection has not been disposed, resulting in a memory leak. Allocated from:
    Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator)
    UnityUserReportingPlatform.Post() at Assets\Plugins\UserReporting\Scripts\Plugin\UnityUserReportingPlatform.cs:377
    375: {
    376: UnityWebRequest webRequest = new UnityWebRequest(endpoint, "POST");
    -->377: webRequest.uploadHandler = new UploadHandlerRaw(content);
    378: webRequest.downloadHandler = new DownloadHandlerBuffer();
    379: webRequest.SetRequestHeader("Content-Type", contentType);
     
  2. ValeryNikulina

    ValeryNikulina

    Unity Technologies

    Joined:
    Oct 26, 2020
    Posts:
    138
    Hi,

    Could you please let me know when you see this error?
     
  3. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    72
    Hello, this happens at seemingly random times in the editor.
     
  4. ValeryNikulina

    ValeryNikulina

    Unity Technologies

    Joined:
    Oct 26, 2020
    Posts:
    138
    Hi,

    I've spoken to the dev team and it appears to be the known bug that is fixed in the upcoming new version of the User Reporting package. We will release an updated SDK through the package manager, and updated documentation, so please bear with us for a little more!
     
    Falondrian likes this.
  5. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    239
    RRD123 likes this.