From: Andrew Apted Date: Sat, 16 Sep 2000 14:03:47 +1000 To: djgpp AT delorie DOT com Subject: Re: Malloc bug in DJGPP V2.03 Message-ID: <20000916140347.B284@ajax.netspace.net.au> References: <20000911155441 DOT A493 AT ajax DOT netspace DOT net DOT au> <8pl56t$3v2$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <8pl56t$3v2$1@nets3.rz.RWTH-Aachen.DE>; from broeker@physik.rwth-aachen.de on Tue, Sep 12, 2000 at 11:48:45AM +0000 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 Hans-Bernhard Broeker writes: > Andrew Apted wrote: > > I'm experiencing a problem with my DJGPP program (glBSP, a nodes > > builder for DOOM) where it runs out of memory under DOS, even though > > there should be plenty left. I've memory-profiled the code (under > > Linux), and the most it ever uses (not including overheads) is 9 MB, > > yet my machine has 64 MB RAM. This is with DJGPP V2.03. > > The strategy you use to do the allocation is prone of causing heap > fragmentation at an enormous rate. Using realloc() to increase memory > block sizes in as small steps as you do it leaves back a huge trail of > small-size blocks that are not available to be reused for larger > blocks, later. OK, I can understand that, and I'll be fixing my source to improve the situation (using realloc in large steps would help, right ?), though I don't understand why my program works fine under Linux (same machine) and Win32 (similiar machine) but fails under DOS/DJGPP. I suspect that DJGPP's malloc could be improved to cope with certain allocation limitations in DPMIs (like CWSDPMI, as I mentioned before changing its internal heap parameter affects how far the testmem program gets), unfortunately I don't have the time to work on it. Cheers, __ \/ Andrew Apted