3 ms·
To be pedantic, Linux doesn't care about how malloc is implemented. That's purely userspace's concern. But yes, the default glibc allocator does have dedicated
by flaviut 4y ago
To be pedantic, Linux doesn't care about how malloc is implemented. That's purely userspace's concern.
But yes, the default glibc allocator does have dedicated areas for specific sizes of allocation:
> The normal bins are divided into "small" bins, where each chunk is the same size, and "large" bins, where chunks are a range of sizes[1]
But fixing heap fragmentation doesn't make linked lists suddenly fast. You still have your cache bloated with the overhead bytes needed for allocation. List elements can still be allocated non-contiguously, giving the prefetcher a bad day.
[1]: https://sourceware.org/glibc/wiki/MallocInternals#Arenas_and_Heaps https://sourceware.org/glibc/wiki/MallocInternals#Arenas_and...