🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #46594

Re: Getting available memory size

#46594
From: S HULL
Date: Thu, 03 Nov 1994 21:16
36 lines
1958 bytes
Pete Golda (PGOLDA@eleceng.uct.ac.za) wrote:
: Hi,

: I'm working on some large data sets (+100Meg), and GNUC has solved
: most of my problems in that I can allocate enough memory to hold the
: entire file. However, when swapping to disk begins, the entire process
: infinitely slows down. Knowing that my PC has 32meg of RAM, and that
: about 2 meg is already used, I now allocate a +/- 28meg array, block
: read 28meg from file and process. Once that's finished I write to file
: and read in the next 28meg block.

: My question:

: Is there any way to find out the size of the available free memory 
: (including base and extended and all that) ??

: I want to automate this process of memory allocation such as:

: FreeMem = FindAllFreeMemory();
: FreeMem *= 0.9  /* Leave 10% of memory for safety */
: char *array = malloc( (long) FreeMem );

: so that the programs can run on machines with any amount of RAM, and
: automatically detect how large the array may be so as to aviod disk
: swapping.

: Thanx in advance,
: Pete.

In the sample/test programs there is one that returns all the memory
statistics including physical free memory, I think it was called 
DPMI.C.

Sorry I can't remember the routine name, but it is in there.

S.Hull@bradford.ac.uk
Technical Details
Message-ID: <39bjun$kkp@columbia.acc.brad.ac.uk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!uknet!strath-cs!bradford.ac.uk!shull
References: <PGOLDA.17.783786893@eleceng.uct.ac.za>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,189da423332f2509
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1994-11-03 13:16:07 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!uknet!strath-cs!bradford.ac.uk!shull
From: S.Hull@bradford.ac.uk (S HULL)
Newsgroups: gnu.gcc.help
Subject: Re: Getting available memory size
Date: 3 Nov 1994 21:16:07 GMT
Organization: University of Bradford
Lines: 37
Distribution: world
Message-ID: <39bjun$kkp@columbia.acc.brad.ac.uk>
References: <PGOLDA.17.783786893@eleceng.uct.ac.za>
NNTP-Posting-Host: ccw308.acc.brad.ac.uk
X-Newsreader: TIN [version 1.2 PL2]