Search Unity

Internal memory leak results into a crush every time I start the game

Discussion in 'Windows' started by AyoubGharbi, Jul 11, 2019.

  1. AyoubGharbi

    AyoubGharbi

    Joined:
    Dec 14, 2017
    Posts:
    4
    To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations

    (Filename: C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp Line: 541)

    Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak


    This message is spamming my log every second on a build or in Unity.

    The game crashes as soon as I start it (Unity 2019.1.9f1 and previous versions as well).

    The game is running on windows using steam api.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,364
    I assume this happens specifically on your project and not every project on your machine?

    Do you have a callstack for the crash in the build?
     
  3. AyoubGharbi

    AyoubGharbi

    Joined:
    Dec 14, 2017
    Posts:
    4
    @Tautvydas-Zilys No I don't, I will try to give you a stack trace from a build.
     
  4. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    172
    This happens for me and has been happening @Tautvydas-Zilys since I installed 2019 and all the entities packages. It is definitely an internal leak from Unity's side from what I can gather.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,364
    Can you file a bug report then with a repro of this?
     
  6. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    172
    I believe there is already a bug report about this. I found it going back to 2017.2. Do you need another post then?
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,364
  8. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    172
    hmmm, okay thanks @Tautvydas-Zilys. Is there anyway to find anymore information as to why that call is coming in? The only way I can think to debug it is by loading a brand new project and slowly importing everything in. That will be a huge pain in the butt. I have SteamVR installed as well.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,364
    Unfortunately not :(. May I suggest making a copy of your project, and deleting half a scene at a time (like a binary search) to find the culprit?
     
  10. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    172
    @Tautvydas-Zilys So sorry, I am an idiot and was having a temp job leak. Details are here.

    https://forum.unity.com/threads/job...that-are-more-than-4-frames-old.513124/page-3

    Was creating 4 TempJob NativeArrays (in an OnCreate) that would normally be disposed every frame if the system was updating. However that OnUpdate wasn't being fired cause the query on that system was zero so these temp Native Arrays were not being disposed properly.

    Sorry for being accusing or if I came off as a dick. I would love a better stack trace if a TempJob is created and then not disposed.