www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/03/18:15:29

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

Greg Cheak wrote:
> 
> I have a program called "Cover" (circa 1993) that builds large tables in
> memory. It uses a simple call to malloc() to allocate space for these tables.
> If the call fails, it returns an error code (NULL). This is usually due to
> lack of memory to complete the operation based on the parameters I have set. I
> have 32mb RAM.
> 
> The program, a Unix port, compiles straight away with DJGPP.  What I would
> like to do is use  DPMI (CWSDPMI) functions to allocate as much memory as I
> can, so that I can set larger paramters for this program. Even running in
> Win95 with DPMI set to 65535, the program seems not to see it. Is there sample
> code explaining the usage of DPMI in a program? I suspect I would have to use
> a swap file as well.

What Charles Terry said is entirely correct; I should add that, to see
how much physical and virtual memory DJGPP programs think is available,
type "go32-v2" from the DOS prompt.  If the numbers add up to less than
64 MB, make sure you have the MS-DOS prompt properties sheet configured
properly in Windows 95.

Please also note that DJGPP malloc() rounds all memory requests up to
the nearest power of 2, and Windows 95's DPMI host won't let you
allocate any more than half of the remaining virtual memory in any
single chunk.  So, calling malloc() with a request greater than or near
to 32 MB is almost guaranteed to fail even though it looks like you have
enough available memory.

If you don't like this behavior, run in DOS with cwsdpmi, which lets you
use up to 256 MB of combined physical and virtual memory (up to 512 MB
with revision 4).

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "A committee is a life form with six |
|       aka Fighteer I       | or more legs and no brain."          |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------

- Raw text -


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