Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

Discussion in 'Entity Component System' started by wikmanyo, Jun 27, 2020.

  1. wikmanyo

    wikmanyo

    Joined:
    Nov 17, 2012
    Posts:
    65
    I have a bunch of jobs (10 or so) scheduled, each job relies on the previous job to complete...

    If I do this (in a coroutine):

    JobHandle handle = DoMyJobs(m_data);
    JobHandle.ScheduleBatchedJobs();
    handle.Complete();

    No warning occur, everyone is happy, and we get a nice big stall until the jobs are done...

    If however I do this (in a coroutine)

    JobHandle handle = DoMyJobs(m_data);
    JobHandle.ScheduleBatchedJobs();
    while (true)
    {
    if (handle.IsCompleted)
    break;
    yield return null;
    }
    handle.Complete();

    I get spammed with:
    Internal: JobTempAlloc has allocations that are more than 4 frames old

    I found some vague mentions in some vague threads elsewhere that jobs are allowed to last more than 4 frames, so what is going on? All my allocations are persistent native arrays, I use no temp allocations at all...

    Help Please!

     
  2. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    I don't understand this code :

    while (true) --> infinite loop
    {
    if (handle.IsCompleted) --> if job completed
    break; --> exit infinit loop
    yield return null; --> if not exit coroutine (so job is not completed)
    }
    handle.Complete(); --> force complete the job, but after that loop it should already be completed.. no ?

    As for the warning message, maybe you are using a unity method in your job that used a temp alloc without beeing aware of it.
     
  3. wikmanyo

    wikmanyo

    Joined:
    Nov 17, 2012
    Posts:
    65
    If anyone else is getting this problem, it appears support for jobs lasting 4 frames or longer has not been implemented in to Unity 2018LTS :(

    Running the same code in unity 2019 works without the spam.

    Is there any plan to fix the spam in Unity2018 LTS?