www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/24/11:50:56

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Available memory ?
Date: 24 May 1997 07:00:07 GMT
Organization: Oxford University, England
Lines: 37
Message-ID: <5m63ln$mqt@news.ox.ac.uk>
References: <199705231801 DOT UAA25915 AT ikp DOT atm DOT com DOT pl>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Dor (dor AT ikp DOT atm DOT com DOT pl) wrote:

: I am new in DJGPP and I know that you will be angry 
: with me for so stupid question, but I couldn't find
: any function returning amount of available memory on the heap.
:   I was looking in C library manual but in section "Memory"
: there is only allocation in million ways, copying memory
: blocks, freeing allocated memory, but how much space there is ?

It's difficult to say. Since DJGPP uses a DPMI server to get the memory,
it all depends on what the DPMI server will tell you. They all vary in how
much they give, anyway. There are DPMI calls to return available physical
memory and virtual memory (I can't remember the names offhand; type `info
libc a' and look at __dpmi_remaining_*_memory perhaps), but as I just said
they aren't completely reliable. One point is that if you malloc memory
then free it it won't go back to the DPMI server; it remains in a `pool'
of memory, which is still available for mallocs. 

In general, though, you shouldn't worry too much about available RAM;
since it's DPMI, you'll get a heck of a lot of it in general. CWSDPMI is
particularly generous; you get any free physical (up to 128Mb) plus any
free hard disk space as virtual memory, up to 128Mb again, for a maximum
of 256Mb.

Windows isn't quite so generous; I'm not sure about 3.x, but in Win95 you
should set the DPMI memory (right-click, properties, memory) to 65535 IIRC
(type it, it's not on the list). Otherwise you don't get given much.

Of course, a simple way to find out whether you can allocate what you want
is to do it in one block at the start, and see whether you're given it or
not.

-- 
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford

What's the wizard's password for? (dunnet)

- Raw text -


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