Search Unity

Memory leak warnings spammed until Editor is restarted

Discussion in 'Entity Component System' started by DK_A5B, Apr 5, 2019.

  1. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    Whenever I do something that introduces a bug which causes a memory leak using ECS, I've noticed it requires a restart of the Editor. Otherwise, even after I've fixed the issue, my Console is spammed with the following warning messages over and run when playing:
    "Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and liked a leak"
    "To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations"

    To be clear, this happens when I introduce a bug and corresponding memory leak into my code, but it continues after I've fixed the bug and recompiled the code. The warnings continue to spam no matter how many times I recompile and stop/start play. However, as soon as I close the Editor and reopen, running with the same code with no changes (since the bug was fixed), the warnings no longer appear.

    This isn't worst issue in the world, but having to restart the Editor every time I want to retest a fix for a memory leak is rather frustrating.

    I'm running Unity 2019.1.0b10. Is there perhaps something I can do to update my configuration to resolve this issue?
     
  2. joseph-t83

    joseph-t83

    Joined:
    Mar 28, 2014
    Posts:
    22
    I have the same thing happening.
     
    JesOb likes this.
  3. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    90
    Same problem. How to know where memory leak?
     
    JesOb likes this.
  4. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    Can confirm, whenever there's an error in my system, my NativeArrays don't get disposed ( due to error halting the dispose process ) and then the editor keeps spamming TLA_DEBUG_STACK_LEAK even after exiting PlayMode.
     
    echeg likes this.
  5. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    90
    Yep same thing
     
  6. Init33

    Init33

    Joined:
    Aug 30, 2017
    Posts:
    67
    Not sure if its directly relevant but have you tried going to Jobs tab, then Leak Detection -> Full Stack Traces (Expensive). Might give you more of an idea where bad things are happening.
     
  7. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    Just to be clear on this, I'm not having a problem finding the memory leak. In all of these cases, I'm able to find and fix the memory leak. The issue I'm describing is that even after the memory leak is fixed, and the code is recompiled, I'm still getting spammed with Memory Leak warning messages. The Error messages on the console related to the memory leak are gone (because the leak is fixed), but the warning messages just constantly spam (even though the leak is gone).

    The only way that I've found to get the warnings to stop is to restart the Editor. This works, but it's time consuming to have to restart the Editor every time I fix a bug.
     
    learc83 likes this.
  8. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Try looking at the Hierarchy view of the Profiler window. The rightmost column should be a warning sign. That column displays how many JobAlloc.Overflow warnings were generated from the System/MonoBehaviour. I would say that you can pinpoint the source of your warnings using this information, but some of the JobAlloc.Overflow errors originate from the SimulationSystemGroup and are thus out of the developer's control. This may be a bug
     
  9. floboc

    floboc

    Joined:
    Oct 31, 2017
    Posts:
    91
    +1 for a practical solution. Closing and reopening the editor takes about 10minutes on my current project, whcih slows done the development process.