Date: Tue, 3 Feb 1998 18:23:12 -0800 (PST) Message-Id: <199802040223.SAA05040@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: ernomat AT evitech DOT fi (Erno Tuomainen), djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Memory usage tracking Precedence: bulk At 04:35 2/3/1998 GMT, 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. Well, yes, but I think it will not quite do what you want. See the function `__dpmi_get_free_memory_information'. However, this reports only the amount of memory the DPMI server has available. When you `malloc' a block, `malloc' may take more memory than you asked for, for reasons of efficiency. Furthermore, `free' does not actually return memory to the DPMI system, but only keeps it available for further `malloc's. So it will not help you find memory leaks, etc. The usual method is to write a wrapper around `malloc'/`free' which keeps track of all that. Nate Eldredge eldredge AT ap DOT net