#Cannot exceed budget of 16777216 in BlockAllocator

1 messages · Page 1 of 1 (latest)

eager rock
#

Hello, we recently have come accross this error causing crashes. The allocated archetype memory is around 9 MB so there should be planty of space for more allocations.

EntityCommandBuffer was recorded in Unknown and played back in Unity.Entities.BeginInitializationEntityCommandBufferSystem.```
obtuse island
#

pretty sure you've hit some chunk or archetype limit

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

if you bump this up does it go away

#

line 677 EntityComponentStore (in 1.1.0)

#

it's a strong sign you're doing too many add/remove components though

eager rock
#

I checked from the archetype window, and it seems to have around 9 MB occupied when this issue gets triggered, following the stack trace from the debugger, the command buffer generating it seems to have ~11 operations, with a bunch of add/remove of tags

obtuse island
#

Doesn't the archetype window show memory used by chunks

#

Not the actual archetypes

#

Chunk memory is unlimited*

#

This type of chain of structural changes will create a huge amount of archetype variations really quick

#

If you must do archetype changes at least use the overload that can do a bunch of add or removes at once

#

You can only have around 8-10k unique archetypes

#

If you do the maths, that's about 12-13 components and every variation

eager rock
#

i have ~300 archetypes atm

errant hatch
obtuse island
#

Because im doubtful you have 300

eager rock
#

probably active

obtuse island
#

In archetype window show empty archetypes

eager rock
#

ok, total archetype 1668

obtuse island
#

You have 300 active archetypes, if you have 11 pertains to get here from a single job that's potentially 3000 archetypes

#

From 1 job

#

Now do every other command buffer

errant hatch
#

🤔 I believe the maximum achetype count limit at runtime is 1024. More than 1024 archetype will throw u the error

eager rock
#

What's the overload to make all those add/remove in a single structural change? Can't find it

obtuse island
#

ComponentTypes

#

Notice the s

eager rock
#

"public void EntityCommandBuffer.AddComponent(int sortKey, Entity e, in ComponentTypeSet typeSet)" ?

obtuse island
#

oh yeah thats what it's called now

#

if you have say 6 components

#

and call Add 6 times in a row

#

that's 6 new archetypes you've created

#

if you do this, it won't create each individual varation, only the final one

#

also check out the memory profiler for entities

#

it should let you see your archetypes properly -edit- i lied shows the same info

eager rock
#

ok, many thanks, i'll try this and come back if still have the issue

eager rock
#

@obtuse island Is there also an operation which allows multiple different operations (both add and remove) in a single structural change ?

eager rock
#

Hello there again, unfortunately i've tryed optimize all the places where i make adds or removes, but still have the issue

errant hatch
obtuse island
#

How often are you adding and removing components? And how many total components do you have that you add or remove

eager rock
#

Normally around 2-6 add/remove of various components each frame, at some specific peaks around 12-15