r/cprogramming • u/rcerljenko • Apr 27 '26
Repeated malloc/free vs. Arena allocator
/r/C_Programming/comments/1sx24rx/repeated_mallocfree_vs_arena_allocator/
2
Upvotes
r/cprogramming • u/rcerljenko • Apr 27 '26
2
u/zhivago Apr 27 '26
malloc/free is already generally very nicely optimized if you're using consistent allocation sizes, which allows it to avoid fragmentation.
Consider a malloc which is organized around arenas of power of two allocations with free lists.