Message-Id: <199809040315.XAA14876@delorie.com> Comments: Authenticated sender is From: "George Foot" To: SuSaNNa <_susanna_ AT yahoo DOT com> Date: Fri, 4 Sep 1998 04:13:22 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: I CAN'T FREE MY MEMORY Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk On 4 Sep 98 at 3:28, SuSaNNa wrote: > When i malloc() some memory, and i free(), > _go32_dpmi_get_free_memory_information not changes > why? where is my memory? > > in a document about dpmi i was reading: > > "when you call free(), go32 doesn't return memory to the system, it just > adds it to its internal pool of free pages. So from the system point of > view, thes pages are not 'free' " That's the answer to your above question -- the memory is reusable by future mallocs, but as far as the DPMI host is concerned it's not actually free. > well, but if i need to "reality" free my memory, What can i do? Allocate it yourself using DPMI functions to obtain a memory block from the DPMI server, and free it yourself when you've finished with it. Look up `__dpmi_allocate_memory' and `__dpmi_free_memory' if you really need to do this, but why do you really care whether or not the memory is really free? It'll be paged to disk sooner or later because it's not being used any more. In a single-tasking environment, your program is the only one running, and your program can reuse the memory so there's no problem. By far the most common multitasking environment is Windows, which is relatively stingy with memory anyway. It only offers you memory out of a certain quota anyway, so there's probably plenty left even if you burned up everything it offered you. -- george DOT foot AT merton DOT oxford DOT ac DOT uk