Mail Archives: djgpp/2004/03/05/04:22:31
> From: CBFalconer <cbfalconer AT yahoo DOT com>
> 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'.
- Raw text -