malloc
Wolfram Gloger
wmglo@dent.med.uni-muenchen.de
Sun Sep 9 05:09:00 GMT 2001
> blackdragon@tyler.net writes:
>
> > why is malloc so bloody slow? some programs (including perl) carry their
> > own malloc to evade this
>
> The malloc in glibc is not slow. It has a number of features:
> - thread safe
> - allows debugging
> - has internal checks
All true, but you forgot the most important feature:
- extremely memory-efficient, i.e. low fragmentation
The malloc in Perl is indeed the fastest malloc I know.
Unfortunately, it rounds allocated sizes to the next power of two in
many cases. For a general purpose allocator, this is not really
acceptable as it wastes _lots_ of memory.
> But what I'm most interested in is actually data where glibc's malloc
> is really slow. Please show us an example, otherwise any such
> discussion is void,
Indeed.
Regards,
Wolfram.
More information about the Libc-alpha
mailing list