From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Memory usage tracking Date: Tue, 03 Feb 1998 19:07:59 -0500 Organization: Two pounds of chaos and a pinch of salt. Lines: 31 Message-ID: <34D7B15F.3863@cs.com> References: <34d7375b DOT 6623488 AT news DOT freenet DOT hut DOT fi> NNTP-Posting-Host: ppp204.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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." | ---------------------------------------------------------------------