Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. We are looking for feedback on the naming of a new user research platform that we are working on.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to ge

Discussion in '2019.1 Beta' started by Carpet_Head, Feb 18, 2019.

  1. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    149
    Code (CSharp):
    1. A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.

    How do I enable Full Stacktraces? which Unity version supports this?
     
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,302
  3. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    149
    It doesn't seem to make any difference

    upload_2019-2-18_17-37-56.png
     
  4. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    149
    to elaborate: we are looking to find bugs in code we wrote that is leaking native collections. It is a complex system so it is hard to track down the issues without seeing where the collections were created
     
  5. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    133
    Menu Job/Leak Detection/Full Stack Traces (Expensive)
    I'm not sure about leaks before the activation so maybe you'll need to restart the editor after enabled.

    []'s
     
    brand_at_tobii and snotbubblelou like this.
  6. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    149
    Thanks!

    I still couldn't find it - looks like you have to enable the Entities package explicitly to get this option. Burst and Collections are not enough on their own.
     
  7. scobi

    scobi

    Unity Technologies

    Joined:
    May 14, 2014
    Posts:
    32
    It's actually the com.unity.jobs package that provides this menu - but com.unity.entities uses it as a dependency, so bringing in Entities will also work.

    I'll write up a bug for us to make the situation better. It's obviously weird that you have to bring in a package to enable debugging something in the core. At minimum, we'll make it a more useful error message. Sorry for the trouble!
     
    chantey and elcionap like this.
  8. DropNodes

    DropNodes

    Joined:
    Jun 11, 2019
    Posts:
    39
    So enabling this stops the error message, but I don't see how to check if/where I have a memory leak
     
  9. scobi

    scobi

    Unity Technologies

    Joined:
    May 14, 2014
    Posts:
    32
    (Sorry I almost missed this reply.)

    Enabling "full stack traces" should not stop the error message, so I'm confused by this behavior change. All that option does is capture a stack trace on the construction of every object that can be leaked. If a leak is detected, this stack trace is dumped as part of the report.

    "Full stack traces" shouldn't have any effect on leak detection, just leak reporting detail.
     
unityunity