Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Internal: JobTempAlloc ... lifespan of 4 frames .. leak - is Debug.log/StackTrace related?

Discussion in 'C# Job System' started by WBonX, Jan 13, 2023.

  1. WBonX

    WBonX

    Joined:
    Aug 7, 2018
    Posts:
    49
    On unity 2022.2.1f - Windows 10.
    In editor and Win Builds player log.

    The errors appears randomly after some Debug.Log calls .. and seems to be related to:
    UnityEngine.StackTraceUtility:ExtractStackTrace ()

    Deleting the Debug.Log calls or disabling the stacktrace from the log makes most of them disappear.

    Is this some internal bug where the stack trace is jobified?
    Could someone point me to what exactly is internally managed by the JobSystem in unity? Update calls, StackTrace, coroutines, is there any internal check on pure C# tasks age? (guess they should be indipendent)

    Code (CSharp):
    1. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 11)
    2. Processing queue in navmesh left are : 2 blockall is: False
    3. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    4. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    5. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    6. UnityEngine.Debug:Log (object)
     
  2. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    It's probably related to the Memory that you're allocating for the String that Debug.Log() is supposed to write out.

    Most of the internal checks are related to memory allocation & deallocation
     
  3. WBonX

    WBonX

    Joined:
    Aug 7, 2018
    Posts:
    49
    Or the memory the stacktraceutility uses when called by the log. This is with the leak diagnostic on.
    Beacause of the Debug.log call and since deleting them makes the error disappear I thought this is some internal stuff related to the StackTraceUtility.
    But I can't fully understand the diagnotic log.

    Code (CSharp):
    1. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 9)
    2. Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak
    3. To Debug, run app with -diag-job-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.
    4. Allocation of 512 bytes at 4056c880 in block 1 (frameIndex=8, lifetime=4, age=4, state=OK)
    5. 0x00007ff79c5da422 (Unity) ujob_schedule_parallel_for_internal
    6. 0x00007ff79c5da2cc (Unity) ujob_schedule_parallel_for
    7. 0x00007ff79c5d7919 (Unity) JobQueue::ScheduleJobsForEach
    8. 0x00007ff79c5d632d (Unity) ScheduleJobForEachInternal
    9. 0x00007ff79cc8f208 (Unity) ScheduleJobForEach<BuildNavMeshInfo>
    10. 0x00007ff79cc93f1d (Unity) ClassifyTilesAndComputeMeshJob
    11. 0x00007ff79cc8e847 (Unity) AggregateJobCombineFunc<BuildNavMeshInfo>
    12. 0x00007ff79c5d99a8 (Unity) ujob_execute_job
    13. 0x00007ff79c5d9007 (Unity) lane_guts
    14. 0x00007ff79c5daeb4 (Unity) worker_thread_routine
    15. 0x00007ff79c7f2ff7 (Unity) Thread::RunThreadWrapper
    16. 0x00007ffa6c1e74b4 (KERNEL32) BaseThreadInitThunk
    17. 0x00007ffa6dda26a1 (ntdll) RtlUserThreadStart
    18. 01 00 00 00 07 00 00 00 02 00 00 00 00 00 00 00  ................
    19. c0 c8 56 40 a4 02 00 00 a1 26 da 6d fa 7f 00 00  ..V@.....&.m....
    20. 00 00 00 00 00 00 00 00 00 00 00 00 43 22 fd 3f  ............C".?
    21. 46 5f 2c bf e7 d5 12 bf 00 00 00 00 06 3f b1 3f  F_,..........?.?
    22. 02 00 00 00 02 00 00 00 09 00 00 00 00 00 00 00  ................
    23. 00 c9 56 40 a4 02 00 00 c8 d2 ad 3f 00 00 00 00  ..V@.......?....
    24. 00 00 00 00 00 00 00 00 00 00 00 00 43 22 fd 3f  ............C".?
    25. 46 5f 2c bf e7 d5 12 bf 00 00 00 00 06 3f b1 3f  F_,..........?.?
    26. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 11)
    27. Processing queue in navmesh left are : 2 blockall is: False
    28. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    29. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
     
    Last edited: Jan 13, 2023