Date: Fri, 9 Jul 1993 21:50:19 -0600 From: jweiss AT silver DOT sdsmt DOT edu (John M. Weiss) To: djgpp AT sun DOT soe DOT clarkson DOT edu Earlier today I wrote: > Does anyone know how to query the amount of available physical RAM > using gcc? Turbo C provides the coreleft() routine, but this is not > part of the standard C libraries. I seem to remember seeing some code > that made use of brk/sbrk to do this once upon a time... In response to a couple of replies to this message, let me be slightly more explicit. I am interested in finding out how much *electronic* heap space is available to my program at any given time. One solution might be to put malloc() or sbrk() in a loop, until all heap space is exhausted and a NULL pointer is returned. In addition to the obvious inefficiency, the virtual memory facility of DJGPP causes problems with this approach. Motivation for the above: I am writing an image processing program that makes use of 2-D fast Fourier transforms. 2-D FFT's are very memory-intensive, involving complex Fourier coefficients (i.e., 8 bytes per pixel). This memory gets allocated/deallocated dynamically with malloc()/free(). Although in-memory FFT's are not too bad, even the so-called "fast" transform is *extremely* slow if disk-swapping is required. Therefore it is important for me to know in advance whether or not I have enough physical memory (not virtual memory) available to do everything in RAM. Any suggestions? Thanks again - JW Dr. John M. Weiss, Associate Professor Department of Mathematics and Computer Science South Dakota School of Mines and Technology 501 East St. Joseph Street Rapid City, SD 57701-3995 605-394-6145 jweiss AT silver DOT sdsmt DOT edu