This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: malloc
- To: aj at suse dot de
- Subject: Re: malloc
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- Date: 9 Sep 2001 12:09:01 -0000
- CC: blackdragon at tyler dot net, libc-alpha at sources dot redhat dot com
- References: <3B9A770C.E2F50CD6@tyler.net> <u8zo84hmyo.fsf@gromit.moeb>
> 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.