X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3CB8529C.2D090EA0@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: New DJGPP hogs memory (was: I need help) References: <5 DOT 0 DOT 2 DOT 1 DOT 0 DOT 20020410122845 DOT 00bcbbd8 AT pop DOT mail DOT yahoo DOT com> <5 DOT 0 DOT 2 DOT 1 DOT 0 DOT 20020410122845 DOT 00bcbbd8 AT pop DOT mail DOT yahoo DOT com> <5 DOT 0 DOT 2 DOT 1 DOT 0 DOT 20020411161942 DOT 00bd1eb0 AT pop DOT mail DOT yahoo DOT com> <2593-Fri12Apr2002115014+0300-eliz AT is DOT elta DOT co DOT il> <3CB6C8FA DOT 45A31BB7 AT yahoo DOT com> <3CB71962 DOT 1D21ED00 AT yahoo DOT com> <3CB75923 DOT C43539D5 AT yahoo DOT com> <4098-Sat13Apr2002112609+0300-eliz AT is DOT elta DOT co DOT il> <3CB807B3 DOT 829AFC09 AT yahoo DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 44 Date: Sat, 13 Apr 2002 16:14:59 GMT NNTP-Posting-Host: 12.90.169.231 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1018714499 12.90.169.231 (Sat, 13 Apr 2002 16:14:59 GMT) NNTP-Posting-Date: Sat, 13 Apr 2002 16:14:59 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com CBFalconer wrote: > Eli Zaretskii wrote: > > > > > From: CBFalconer > > > 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 > article. URL correction: -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!