X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Fri, 05 Mar 2004 11:19:24 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <2914-Fri05Mar2004111923+0200-eliz@elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <4047C3E0.CA1CC67F@yahoo.com> (message from CBFalconer on Fri, 05 Mar 2004 03:53:37 GMT) Subject: Re: Speed of free() References: <40457b5c DOT 5675949 AT localhost> <4045C364 DOT 41EFB535 AT yahoo DOT com> <40469645 DOT 78111865 AT localhost> <4046F311 DOT D6455EA1 AT yahoo DOT com> <40476e97 DOT 133498200 AT localhost> <4047C3E0 DOT CA1CC67F AT yahoo DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: CBFalconer > Newsgroups: comp.os.msdos.djgpp > Date: Fri, 05 Mar 2004 03:53:37 GMT > > > > Maybe it wasn't 2.01 -- I don't understand DJGPP versioning. I > > reverted to the version where 'gcc -v' says 2.8.0 and rebuilt my > > program, and the dreadful free() slowdown went away. For > > comparison: > > > > gcc 2.8.0, n=383701, t=0.33 seconds > > gcc 3.3.3, n=383701, t=136 seconds > > gcc 3.3.3 w/nmalloc, n=383701, t=0.56 seconds > > Interesting. I never used 2.01. malloc/free are in the library. The GCC version doesn't have any relation to the speed of `free'. The OP should run "ident libc.a" and tell what it prints; then it will be clear what version of the library is used in each case. "info kb" will tell you, in the "What's Changed" chapter, that in v2.02, `malloc' and `free' were replaced by a different algorithm, written by DJ Delorie. The previous versions were taken from the BSD library, and `malloc' there wasted memory more than the new version. Prior to the replacement, extensive testing was done (perhaps DJ's site still has a page where the results of those tests are reported), but IIRC only `malloc' was tested, not `free'. As kb.info tells you, the old BSD code is still available in the library source distribution (djlsrNNN.zip) under the name `bsdmallo.c'. So one can use it even with libc.a from v2.03 by compiling bsdmallo.c and using it instead of the library's versions of `malloc' and `free'.