www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/05/01:16:06

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DPMI for Dummies
Date: Sun, 05 Apr 1998 00:40:06 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 37
Message-ID: <35271936.6EF@cs.com>
References: <3523cca3 DOT 0 AT newscene> <35256B92 DOT 76B4 AT cs DOT com> <3526901a DOT 0 AT newscene>
NNTP-Posting-Host: ppp203.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Greg Cheak wrote:
> 
>         By dropping out of Win95 and running CWSDPMI I was able to gain more
> memory; alot more. I also added some code to see just exactly how much memory
> the program was asking for in bytes. What I found was that there was no way I
> would get enough resources (perhaps with a Cray). Then I attempted to add some
> DPMI calls to check available memory in the program, which I may have
> incorrectly called. Curious what the proper call would be to report all
> available memory? I used __dpmi_get_memory_information with a call to
> the total_available_bytes_of_virtual_memory_host member. Is this proper?
> If I had this value I could exit the program more gracefully. In any case its
> running better now with your help. Thanks.

The best functions to return available memory before your program tries
to allocate any are _go32_dpmi_remaining_physical_memory() and
_go32_dpmi_remaining_virtual_memory() (declared in <dpmi.h>).  These
functions return the free physical RAM and the total of free physical
and virtual memory, respectively.  However, they only take into account
the total memory that your program has requested from the DPMI host and
do not reflect free()d memory, which is saved for reuse by malloc(), and
is why it's most accurate to call those functions only at the start of
your program.

If I were you, and your program really does take up so much memory that
it would be better off with a Cray, then you might try to optimize its
memory usage somehow.  Without knowing what you're trying to do it's
difficult to make specific recommendations, though.

hth!

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |     mailto:fighteer AT cs DOT com     |
|      ICQ UIN#:  7406319          |   http://www.cs.com/fighteer/  |
|    ObJoke:  If Bill Gates were a robber, not only would he        |
|     shoot you, but he'd send you a bill for the bullets.          |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019