delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/04/20/09:23:39

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <9804201318.AA13645@clio.rice.edu>
Subject: Re: Available memory
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Date: Mon, 20 Apr 1998 08:18:06 -0600 (CDT)
Cc: dj AT delorie DOT com, nate AT cartsys DOT com, djgpp-workers AT delorie DOT com
In-Reply-To: <Pine.SUN.3.91.980420160421.27814B-100000@is> from "Eli Zaretskii" at Apr 20, 98 04:06:18 pm

> Programs which call `coreleft' want to know how much memory they can 
> use.  So I don't think it is meaningless.  The DPMI calls which return 
> free memory are okay, but they don't include the free blocks already 
> sbrk'ed by the program.  Adding this latter memory will get the job done, 
> I think.

But the free blocks internally managed by malloc() are in size bins, so if
the user wants a big single allocation that memory is essentially not free.

If you are going to mess with it, then it ought to be something like the
non-sbrked available virtual memory, rounded down to the nearest power of
two (or whatever the current malloc does in that case).

Or just return that value maxed with 640K ;-)

- Raw text -


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