Mail Archives: djgpp/1998/02/03/23:20:07
Erno Tuomainen wrote:
>
>
> Are there any methods to check the memory amount allocated by my
> program? Under DJGPP/CWSDPMI.
>
> It would be nice to be able to check the memory usage with a single
> keypress inside my program.
>
> This would help a lot while developing some programs which
> allocate/free mem a lot.
The functions _go32_dpmi_remaining_physical_memory() and
_go32_dpmi_remaining_virtual_memory() can be used to tell how much total
memory your program has allocated from the operating system. They
cannot be used to tell how much memory is available once your program
begins freeing it. In fact, there is no easy way to detect remaining
memory under DPMI, short of designing your own custom allocation
routines. You might want to do this anyway, considering that the
current implementation of malloc() in DJGPP wastes a lot of memory.
Look in the mail archives for a post by DJ Delorie comparing various
malloc() algorithms. DJGPP v2.02 will use a more efficient malloc().
--
---------------------------------------------------------------------
| John M. Aldrich | "Animals can be driven crazy by pla- |
| aka Fighteer I | cing too many in too small a pen. |
| mailto:fighteer AT cs DOT com | Homo sapiens is the only animal that |
| http://www.cs.com/fighteer | voluntarily does this to himself." |
---------------------------------------------------------------------
- Raw text -