[uClibc]looking for a smarter malloc

Ronald Wahl rwa at peppercon.com
Sat Jul 6 00:03:18 UTC 2002


On Fri, 5 Jul 2002 16:25:41 -0600, Erik Andersen wrote:

> On Fri Jul 05, 2002 at 06:16:17PM +0200, Ronald Wahl wrote:
>> Hi,
>> 
>> is there a way to use the malloc from glibc with uClibc? I'm under the
>> impression that the glibc malloc makes more effort in giving unused
>> memory back to the system. AFAIK it uses a comination of brk/sbrk and
>> mmap.

> The latest malloc from glibc is _not_ more efficient than the
> malloc-930716 code currently in uClibc.  For all allocations
> that are likely to occur, both use brk/sbrk (which is the fastest
> method available).  Try doing some time tests... I have.  

> The main differences are that the latest malloc from glibc 1)
> adds a lot of debugging support that IMHO is actually dangerous
> since by default it tends to hide buffer overflows and 2) it uses
> a hybrid allocation approach, such that for massive allocations
> it uses mmap.  So far, I've havn't seen the need for such
> overhead.

> Are you seeing a performance problem?

I'm looking more at memory and not performance resources. :-) 
If you have several processes that allocate big memory chunks that won't
get returned to the system after free in all cases you will soon end
in an out of memory condition I guess. Glibc uses mmap and munmap that
do not have this problem or am I wrong?

ron

-- 
\\      Dipl.-Inf. Ronald Wahl   |   Peppercon AG                  //
 \\\         rwa at peppercon.com  |||  http://www.peppercon.com/   /// 
  \OO  -----------------------  OOO  -------------------------  OO/ 
   OO  GnuPG/PGP key available  OOO  Keep Systems running       OO



More information about the uClibc mailing list