This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: improving malloc
On Sun, Jan 06, 2013 at 10:56:18AM +0100, OndÅej BÃlka wrote:
> > Other considerations are memory fragmentation, how quickly
> > it can give back unused memory to the OS, etc. etc.
> >
> For giving memory back to OS when linux gets volatile ranges then
> we can finally do not have to defer returning memory because zeroing
> pages is expensive.
> I wanted to suggest at linux-kernel to keep pages returned to linux
> at linked list and for allocations prefer these as they do not have
> to be zeroed.
Preferring them is backwards; it will cause more page faults and use
more memory. Once you've returned memory to the kernel, you should
avoid using it again unless absolutely necessary. It's _possible_
that, for some usage cases, calloc would want to use this memory, but
for malloc it's always a pessimization.
Rich