|
|
|
|
|
by Tuna-Fish
1168 days ago
|
|
The gold standard for avoiding fragmentation is what jemalloc does, that is, only allocating objects of similar size from a chunk of memory. That is, instead of a single global heap there exists a pool for every valid size of object (and to keep the numbers low, object sizes are rounded up to some set of buckets). This means that there is more memory wasted for small programs, but as memory use grows the wastage caused by this remains constant and allocation and deallocation will always remain fast. |
|
(It does help in that if you have fixed size slabs, you can't waste space on that page, but you can still waste the entire page.)