Entities 0.10 regression / crash due to entity archetype count (with repo)

The problem here is that a limit for the memory taken up by archetypes was introduced. If you disable Burst, you can see the callstack where the allocation fails. The limit is 16mb, or around 29000 archetypes. It’s helpful to have a limit because you might want to catch exactly this kind of situation. I’ve followed up on this internally and in the short term, we are likely going to increase that limit while in the long term we will make sure that you can set it (to a higher or lower value, whatever is applicable for your game) and get a better error message when that fails.

For the moment, to unblock you: In EntityComponentStore.cs, you will find this line that you can change to match whatever limit makes sense for you:

entities->m_ArchetypeChunkAllocator = new BlockAllocator(AllocatorManager.Persistent, 16 * 1024 * 1024); // 16MB should be enough

Regardless, I would strongly encourage you to look at how you end up with 29000 archetypes. I’m in no position to judge whether that is a reasonable number for your game, but with that number of archetypes I’d personally be suspicious :slight_smile:

cc @bryanmcnett

1 Like