I have a few related questions about managing aligned memory blocks. Cross-platform answers would be ideal. However, as I\'m pretty sure a cross-platform solution does not
You could write your own slab allocator to handle your objects, it could allocate pages at a time using mmap
, maintain a cache of recently-freed addresses for fast allocations, handle all your alignment for you, and give you the flexibility to move/grow objects exactly as you need. malloc
is quite good for general-purpose allocations, but if you know your data layout and allocation needs, you can design a system to hit those requirements exactly.