Why use -lmalloc

Clarence Dold dold at mitisft.Convergent.COM
Tue Apr 2 01:29:48 AEST 1991


in article <2 at bodedo.UUCP>, jon at bodedo.ucm.org (Jon Boede) says:

> I've been puzzled about the existence of a second library for malloc on my

Aside from the differences noted in the manual, there used to be a
tremendous difference in speed for small mallocs.  malloc(3X) sbrks a
large (#defined) arena, then responds to malloc requests from within the
pool, for your application.  There are two tradeoffs that I know.  The
code is quite a bit larger, especially if you are using shared libc, and
now you've added all of -lmalloc, and there is a peculiarity of the old
malloc, that it did not destroy memory contents upon free(), allowing you
to reattach a particular segment later (yech).  This can be changed by
using mallopt().

Additionally, the standard malloc and memory management for sysVr3.2 seems
to be enough smarter that the speed difference has gone away.

-- 
---
Clarence A Dold - dold at tsmiti.Convergent.COM
               ...pyramid!ctnews!tsmiti!dold



More information about the Comp.lang.c mailing list