Mail Archives: djgpp/2000/09/16/10:31:24
Hans-Bernhard Broeker writes:
> Andrew Apted <ajapted AT netspace DOT net DOT au> 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 <ajapted AT users DOT sourceforge DOT net>
- Raw text -