Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: halite AT medison DOT co DOT kr (SangGyu Nam), djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: How can I calculate the amount of free memory? Date: Mon, 20 Apr 1998 18:11:26 -0700 Message-ID: <19980421011110.AAE9311@ppp124.cartsys.com> Precedence: bulk At 10:33 4/20/1998 +0900, SangGyu Nam wrote: >Hello. > >I'm making an image handling program using DPMI. >The program displays some images such as BMP, JPG... >Whenever an image displayed, I traced the free amount of >free memory by using DPMI function 0x0500. >The function returns correct value when I allocate memory >but after free it, I could not get valid information. >Only the amount before free() was returned. > >Someone said, because it's the property of runtime library. >In other words, free() does not return memory to DPMI >automatically. So if I want to get correct information, >must use any function such as _heapshrink(). >The function returns all freed memory to DPMI. But DJGPP has no such function. Currently, there is no way to return freed memory to the DPMI server. >But it did not work. I could not get yet. > >How can I get the realtime free amount of DPMI memory? In brief: You can't. There may be a function added in the future to figure out how much memory `malloc' is sitting on, but currently there is not. If you are trying to debug a memory leak, there are a variety of packages which wrap `malloc' and `free', and will keep track of this for you. MSS is one such. Nate Eldredge nate AT cartsys DOT com