Mail Archives: djgpp/2002/04/13/12:30:26.1
> Eli Zaretskii wrote:
> > > From: CBFalconer <cbfalconer AT yahoo DOT com>
> > > Newsgroups: comp.os.msdos.djgpp
> > > Date: Fri, 12 Apr 2002 22:17:04 GMT
> > >
> > > First, nmalloc seems to have had no faults shown up with this. It
> > > appears to handle this continuous realloc about 2 to 4 times
> > > faster, and to use less memory in the aggregate. Note that
> > > evilalgo segfaulted with an input parameter of 45000, while
> > > nmalloc lets it handle at least 100000 without squealing (with my
> > > memory constraints).
> > The segfaults are not the important factor here, and might even hide
> > the actual performance issue (memory efficiency) from view: the
> > program crashes because it doesn't test the pointer returned by
> > realloc before dereferencing it.
> > It is much better to modify the code slightly to test whether realloc
> > returns NULL, and if so, print the iteration count (and/or the amount
> > of memory it succeeded to allocate) and exit. Then you'd have a more
> > accurate quantitative measure of the memory overhead enforced by the
> > kind of ridiculously bad reallocation code such as the one used by
> > this program.
> I did that. I started from someones evil code, just as a test.
> See the version in
> Compare the times when it doesn't segfault for the previous
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
- Raw text -