delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/03/19/12:52:10

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 19 Mar 2004 12:51:09 -0500
Message-Id: <200403191751.i2JHp99L022683@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <c3f2m1$217i$1@alpha2.radio-msu.net> (akantsel@integra.rmt.ru)
Subject: Re: How can I monitor the amount of free RAM?
References: <c3f2m1$217i$1 AT alpha2 DOT radio-msu DOT net>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 1. What memory should I monitor (DOS (below 1MB), upper,...)

Virtual.

> 2. How can do that?

You don't want to monitor free memory, you want to monitor *used*
memory (other things on the computer might use memory too).  Most
programs can use the sbrk(0) call to ask libc where the top of your
memory is.  If it doesn't change, you're not asking for more memory.

The exception is if you choose the "non-moving sbrk" option (nearptr,
DMA, etc need this) in which case your memory range is discontiguous
and sbrk() moves all over the place during allocation.  But at least
you can tell if it changes *at all*.

- Raw text -


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