Aligned memory management?

后端 未结 7 1872
清歌不尽
清歌不尽 2020-12-13 05:00

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

7条回答
  •  轮回少年
    2020-12-13 05:19

    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.

提交回复
热议问题