Search Unity

A Native Collection has not been disposed, resulting in a memory leak. I

Discussion in 'Scripting' started by eco_bach, Dec 11, 2018.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Hi
    Exploring the new job system with the webcamprocessing demo from
    https://github.com/stella3d/job-system-cookbook

    Getting the following error
    A Native Collection has not been disposed, resulting in a memory leak. ..

    This is the offending line (within OnEnable())

    Code (csharp):
    1.  
    2.   m_NativeColors = new NativeArray<Color32>(m_Data, Allocator.Persistent);
    3.  

    How would I resolve this?

    in OnDisable() I already have

    Code (csharp):
    1.  
    2.   m_NativeColors.Dispose();
    3.  
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742