Source

Branch

1/ @lectem

@bmcnett @forked_franz

malloc() actually is pretty fast on most implementation.
free() on the other hand… Can be random.

The main problem with mem allocations often is that it does allocations at all, when they could be skipped.
As always “it depends” of the context (OS, allocator, sizes,count, …)