Search Unity

Bug JobTempAlloc has allocations that are more than 4 frames old

Discussion in 'Entity Component System' started by peaj_metric, Oct 6, 2022.

  1. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    My game spams the following messages in the console:
    Code (Boo):
    1.  
    2. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    3. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    4. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 6)
    5. Unity.Collections.Array:Resize(Void*, Int64, Int64, AllocatorHandle, Int64, Int32)
    6. Unity.Collections.Array:Resize(T*, Int64, Int64, AllocatorHandle)
    7. Unity.Collections.Unmanaged:Free(T*, AllocatorHandle)
    8. Unity.Entities.EntityCommandBuffer:FreeChain(EntityCommandBufferChain*, PlaybackPolicy, Boolean)
    9. Unity.Entities.EntityCommandBuffer:Dispose()
    10. Unity.Entities.EntityCommandBufferSystem:FlushPendingBuffers(Boolean)
    11. Unity.Entities.EntityCommandBufferSystem:OnUpdate()
    12. Unity.Entities.ComponentSystem:Update()
    13. Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    14. Unity.Entities.ComponentSystemGroup:OnUpdate()
    15. Unity.Entities.ComponentSystem:Update()
    16. Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    17. Unity.Entities.ComponentSystem:Update()



    [C:\buildslave\unity\build\Runtime\Allocator\ThreadsafeLinearAllocator.cpp line 962127208]


    Code (Boo):
    1. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
    2. Unity.Collections.Array:Resize(Void*, Int64, Int64, AllocatorHandle, Int64, Int32)
    3. Unity.Collections.Array:Resize(T*, Int64, Int64, AllocatorHandle)
    4. Unity.Collections.Unmanaged:Free(T*, AllocatorHandle)
    5. Unity.Entities.EntityCommandBuffer:Dispose()
    6. Unity.Entities.EntityCommandBufferSystem:FlushPendingBuffers(Boolean)
    7. Unity.Entities.EntityCommandBufferSystem:OnUpdate()
    8. Unity.Entities.ComponentSystem:Update()
    9. Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    10. Unity.Entities.ComponentSystemGroup:OnUpdate()
    11. Unity.Entities.ComponentSystem:Update()
    12. Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    13. Unity.Entities.ComponentSystem:Update()
    14.  
    15. [C:\buildslave\unity\build\Runtime\Allocator\ThreadsafeLinearAllocator.cpp line 962127288]
    This only happens in a build not in the editor.
    How can I find out where this allocation happened?

    I have the suspicion it might be connected with the usage of an EntityCommandBuffer in the FixedStepSimulationSystemGroup.
    That might explain why it only happens in a build as the higher framerate will result in more frames between each FixedStep.
     
  2. redwren

    redwren

    Joined:
    Aug 2, 2019
    Posts:
    69
    I've also been dealing with this, using 2020.3 and Entities 0.51.1-preview.21. Every second or so I get
    followed by ~10
    What's really strange is that I can only seem to get this warning when leak detection is turned off and I can't get a stack trace on the allocation no matter what I try.
     
    Last edited: Dec 8, 2022