Search Unity

Feedback Another question about long running jobs and Internal: deleting an allocation that is older than 4

Discussion in 'Entity Component System' started by iamarugin, Jan 20, 2020.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    I am generating a planet. Typical planet consist from many Quads (like 500-700). I am using a long-running jobs to generate each Quad. Also I am using ECS for other stuff.

    To generate a quad I need to schedule a bunch of jobs one after another, so I use JobHandle.CombineDependencies to build a chain of these jobs. Because the whole process can take a significant amount of time, I put job handles in some collection and then check isCompleted every frame. When isCompleted becomes true I call Complete() and actually create Mesh from the generated data.

    What I discovered, that if I schedule generation of several quads at the same time, then they fill up all worker queues and stall the ECS jobs (and the whole loop) at the next frame.

    So, I found a solution: I start next Quad generation only after previous one has finished its jobs. I made it by passing job handle from the previous Quad to the next one. This worked perfect. Only one worker was busy all the time and nothing stalls ECS loop.

    But then I discovered, that console was exploded with warnings, when I schedule like 10-20 quads in a chain:
    Code (CSharp):
    1. Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 6)
    The problem is, that I use only Persistent-allocated collections in my jobs (I double checked this).
    Does this error appear because of dependency chains? Is there any way to avoid this? Is there any way to turn off this warning, since it doesn't give any useful information even if I have Full stack traces enabled and just harm the frame rate for nothing?
     
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    PS Unity 2019.3f3, ECS 0.5.0, game is running on stable 60 FPS