Article View: comp.sys.amiga.tech
Article #9042Re: Free memory available
From: mwm
Date: Wed, 01 Jun 1988 02:46
Date: Wed, 01 Jun 1988 02:46
31 lines
1788 bytes
1788 bytes
In article <6743@cit-vax.Caltech.Edu> glewis@cit-vax.UUCP (Glenn M. Lewis) writes: < What is the "acceptable" way to find out how much memory there is <in the system from a C program (without AllocMem'ing until a failure)? Hmm - our wizards don't seem to be paying attention. Or maybe they answered by mail. Anyway, the call you want is AvailMem(int type). For example: chip_free = AvailMem(MEMF_CHIP) >> 10; fast_free = AvailMem(MEMF_FAST) >> 10; give you the number of K free of each type of memory. However, the amount of free memory and the largest chunk you can allocmem are not the same. For instance, right now I've got 3.6 Meg free, but can't get a chunk bigger than 2 Meg. The problem is that free memory is at scattered locations through the memory spaces, but AllocMem returns contigious memory blocks. I've got a program (frags.c) that explains in gory detail how to walk the free memory list. You're welcome to a copy of that, and tweaking it to find the largest free chunk should be easy. <mike -- The weather is here, I wish you were beautiful. Mike Meyer My thoughts aren't too clear, but don't run away. mwm@berkeley.edu My girlfriend's a bore, my job is too dutiful. ucbvax!mwm Hell nobody's perfect, would you like to play? mwm@ucbjade.BITNET
Technical Details
Message-ID:
<10432@agate.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!scs!spl1!laidbak!att!chinet!mcdchg!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-statReferences:
<6743@cit-vax.Caltech.Edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!scs!spl1!laidbak!att!chinet!mcdchg!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-stat From: mwm@eris.UUCP Newsgroups: comp.sys.amiga.tech Subject: Re: Free memory available Message-ID: <10432@agate.BERKELEY.EDU> Date: 1 Jun 88 02:46:11 GMT Article-I.D.: agate.10432 References: <6743@cit-vax.Caltech.Edu> Sender: usenet@agate.BERKELEY.EDU Distribution: na Organization: Missionaria Phonibalonica Lines: 31