#Error/crash in ECB playback

1 messages · Page 1 of 1 (latest)

blazing blaze
#

Hello! I have this issue that I've not really encountered before, does it mean I'm out of Archetype space?

ArgumentException: Cannot exceed budget of 16777216 in BlockAllocator.
EntityCommandBuffer was recorded in [REDACTED] and played back in Unity.Entities.EndSimulationEntityCommandBufferSystem.
  at Unity.Entities.BlockAllocator.CheckExceededBudget () [0x00028] in [REDACTED]\Library\PackageCache\com.unity.entities@e581b903be8e\Unity.Entities\BlockAllocator.cs:111 
  at Unity.Entities.BlockAllocator.Allocate (System.Int32 bytesToAllocate, System.Int32 alignment) [0x0003c] in [REDACTED]\Library\PackageCache\com.unity.entities@e581b903be8e\Unity.Entities\BlockAllocator.cs:132 
  at Unity.Entities.MatchingArchetype.Create (Unity.Entities.BlockAllocator& allocator, Unity.Entities.Archetype* archetype, Unity.Entities.ArchetypeQuery& archetypeQuery, System.Int32 queryRequiredComponentCount) [0x000de] in [REDACTED]\Library\PackageCache\com.unity.entities@e581b903be8e\Unity.Entities\Iterators\EntityQueryManager.cs:1354 
  at Unity.Entities.EntityQueryManager.AddArchetypeIfMatching (Unity.Entities.Archetype* archetype, Unity.Entities.EntityQueryData* query) [0x0004b] in [REDACTED]\Library\PackageCache\com.unity.entities@e581b903be8e\Unity.Entities\Iterators\EntityQueryManager.cs:956 
  at Unity.Entities.EntityQueryManager.AddAdditionalArchetypes (Unity.Collections.LowLevel.Unsafe.UnsafePtrList`1[T] archetypeList) [0x0001f] in [REDACTED]\Library\PackageCache\com.unity.entities@e581b903be8e\Unity.Entities\Iterators\EntityQueryManager.cs:932 

I've noticed the same issue in another unrelated system but this time with EntityManager (from crash.dmp):

azure island
#

yes

#

you have too many archetypes

blazing blaze
#

ah fuck

blazing blaze
#

Are archetypes stored per entity manager/world?

civic rapids
#

Are you adding/removing components during runtime?

azure island
#

if it's still earlish, fix by not making so many structural changes

blazing blaze
#

turns out someone added a thing that added 15 components in a row one by one 🙃

#

so was an easy fix this time around. We still have a lot of adding component one by one in code so can gain quite a lot of headroom by fixing those

azure island
#

if you're hitting the cap, it means you have 8-12k archetypes

orchid leaf
#

if you add components one by one in the same frame, does it create a new unique archetype for each add component call?

quartz phoenix
orchid leaf
quartz phoenix
#

and how would it do that
it doesn't know when the last add component call is
and if you remove the archetype when the last one is removed, if you create 100 entities adding 15 components one by one each, you will end up allocating and freeing memory constantly

#

batch operations using entity sets and archetypes directly dont have this issue

orchid leaf
# quartz phoenix and how would it do that it doesn't know when the last add component call is and...

and how would it do that

my first thoughts would be buffer adds and removes per entity inside a scope, compute the final type set once, move once at commit, then bump versions and update queries, or stage structural changes until the end of the system or frame, coalesce by entity, then apply in one pass

i think a generalized case could be 100% optimized (unless i'm completely wrong in my thoughts), i know existing apis exist and i mostly use them with predefined archetypes

quartz phoenix
#

ok, sure, so then you do propose a different API
but you said you thought it'd optimize under the hood in the current API
we can agree there may be better ways to do this

orchid leaf
#

that's true

quartz phoenix
#

I recall reading some people have tried to do this kind of thing with entity command buffers, but that it has proven difficult in practice