From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Q. dpmi_free_memory() under allegro. Date: Sun, 03 May 1998 00:22:01 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 35 Message-ID: <354BF0E9.7440@cs.com> References: <2 DOT 2 DOT 16 DOT 19980503100545 DOT 1da75fda AT alphalink DOT com DOT au> NNTP-Posting-Host: ppp142.cs.net 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 aj wrote: > > int main(void) > { > __dpmi_free_mem_info *info; // define pointer > > __dpmi_get_free_memory_information( info ); // call to get info Come on now, you should know better than to write to an unitialized pointer. __dpmi_free_mem_info info; __dpmi_get_free_memory_information( &info ); BTW, the structure returned by this function is not guaranteed to be useful or even meaningful under any particular DPMI host. It's very difficult to accurately determine free memory once your program has started malloc()'ing and free()'ing. To determine how much free memory you have _before_ you allocate or free anything, use _go32_dpmi_remaining_physical_memory() and _go32_dpmi_remaining_virtual_memory(). See chapter 15.2 of the DJGPP FAQ for more information (and you should probably read all of chapter 15 when you can, as it is useful for people who use lots of memory in their programs). hth -- --------------------------------------------------------------------- | John M. Aldrich | "Courage is the complement of fear. | | aka Fighteer I | A man who is fearless cannot be | | mailto:fighteer AT cs DOT com | courageous. (He is also a fool.)" | | http://www.cs.com/fighteer | - Lazarus Long | ---------------------------------------------------------------------