2 ms·
Allocating memory can be as cheap as adding to a number. Even if you want a concurrent allocator, atomic increments are pretty fast compared to any typical mall
by notriddle 10y ago
Allocating memory can be as cheap as adding to a number. Even if you want a concurrent allocator, atomic increments are pretty fast compared to any typical malloc. It's allocating and then freeing that's slow.
A copying-compacting GC has very fast allocation at the cost of very slow freeing (you have to walk memory).
DMD has very fast allocation and never frees memory.