delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/18/14:46:10

From: Apester000 AT aol DOT com
Message-ID: <3ac7af8c.36cc6dcd@aol.com>
Date: Thu, 18 Feb 1999 14:45:17 EST
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: free RAM available
X-Mailer: AOL 3.0 for Windows 95 sub 18
Reply-To: djgpp AT delorie DOT com

>Hi,
>
>How can I get the free RAM available ?

An easy (while not entirely accurate way) is just to make a little loop
allocating memory until malloc failes.  i.e.:

char *p;
long l = 0;
do
{
    p = malloc(1024);
    if (p) l += 1024;
} while (p);

printf("Approximently % d megs of memory", l / 1024);

Regards-
Brandon Tallent
 

- Raw text -


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