Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!voder!pyramid!ctnews!mitisft!dold From: dold@mitisft.Convergent.COM (Clarence Dold) Newsgroups: comp.lang.c Subject: Re: Why use -lmalloc Message-ID: <1946@mitisft.Convergent.COM> Date: 1 Apr 91 15:29:48 GMT References: <2@bodedo.UUCP> Organization: Convergent Technologies, San Jose, CA Lines: 21 in article <2@bodedo.UUCP>, jon@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@tsmiti.Convergent.COM ...pyramid!ctnews!tsmiti!dold