Search Unity

TempAlloc Overflow with BeginExclusiveEntityTransaction

Discussion in 'Entity Component System' started by Soaryn, Apr 7, 2019.

  1. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    I have found that using the code below, when calling "BeginExclusiveEntityTransaction", the profiler shows a warning on TempAlloc.overflow under the system calling the method. Also, with just this code, the system takes on average 0.04ms to do nothing but begin and end the exlcusive 'contract'. Is something awry in the backend? Documentation seems rather low for the ExclusiveEntityTransaction so it is rather difficult if this is intended behavior :p


    Code (CSharp):
    1. using Unity.Entities;
    2. using Unity.Jobs;
    3. [AlwaysUpdateSystem]
    4. public class TestWarningSystem : JobComponentSystem {
    5.     public EntityManager _otherManager;
    6.     protected override void OnCreate() {
    7.         _otherManager = new World("Warning Tester").EntityManager;
    8.     }
    9.  
    10.     protected override JobHandle OnUpdate(JobHandle inputDependencies) {
    11.         _otherManager.EndExclusiveEntityTransaction();
    12.         var transactor = _otherManager.BeginExclusiveEntityTransaction();
    13.         return inputDependencies;
    14.     }
    15. }
    Info:
    ECS version: preview-30
    Unity version: 2019.1.0b10
     
    Last edited: Apr 7, 2019
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    ExclusiveEntityTransaction will complete any jobs that have been scheduled against the world. So it taking 0.04ms seems ok.

    ExclusiveEntityTransaction is generally not something i would recommend on the main world. We usually use it for filling a world for either streaming from data or procedurally and then moving the data live using MoveEntitiesFrom.
     
  3. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    But he use it on EM from custom World, isn’t it? In this case EET should block one of worker threads for processing entities through EET on this worker thread jobs/systems? I use ETT for purposes like streaming (custom world which creates entities without blocking main thread and then move them to default world by MoveEntitiesFrom, but I’m call EET begin/end from system in custom world, not from system in default world which call EM from other world like in his case)
     
  4. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    @Joachim_Ante

    The use case for me is to create a batch of entities in another world then next frame move the entities over. The system works; however, after about an hour I tracked down the profiler's warning to the begin method.

    The warning Im referring to is the last column yield symbol in the profiler.

    My concern with the .04 is that there are no jobs scheduled, that I know of for this. So it is taking that long to complete an empty job that had an entire frame to do.

    As @eizenhorn mentioned, I am using this on another world, not main. I would normally call MoveFrom after the end, but Im trying to tracj down why the profiler is upset.
     
  5. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    I am using EET on a setup world, but it seems that merely calling "BeginExclusiveEntityTransaction" causes a TempAlloc.Overflow regardless of order to when EndExclusive is called.
    Should I be concerned of a potential memory leak as this is in the back end of the Transaction system and kind of out of my hands. exclusiveTransaction.png