|
|
|
|
|
by tptacek
4637 days ago
|
|
That's essentially what I do in much of my C code: implement pool allocators. And that's essentially what the post we're commenting on is talking about. Incidentally, good common case for 8-byte allocations that is actually common in real-world C code: 32 bit linked list nodes (4 bytes nextptr, 4 bytes dataptr). |
|
Linked lists are bad because they have big overhead (8 bytes for every element in your case - which dominates by a large margin if you store an int in each node for example) and they are really bad for CPU caches (they have very little spatial locality), thus slowing down your code.
I much rather prefer the "growing array" approach.