|
|
|
|
|
by nhaehnle
4450 days ago
|
|
The libc memory allocator does not simply hand out memory contiguously. In your example, the 256K block will end up being 4K aligned. In fact, that's what the article already explains: the large alloc will just end up being passed through to the kernel, which only deals at page granularity. |
|
But what does this mean for locality? Will I be thrashing the cache if I use realloc frequently? Do I even have the promise that malloc will return unfragmented memory?