Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    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:
    258
    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?
     
    Shahadat01 and dan_ginovker like this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
  3. Carpet_Head

    Carpet_Head

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

    upload_2019-2-18_17-37-56.png
     
    juanborgesv, Neiist, adamgryu and 6 others like this.
  4. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    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
     
    RiverExplorer likes this.
  5. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    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
     
  6. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    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.
     
    dan_ginovker likes this.
  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!
     
  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.