[fpc-pascal] Memory Size

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Apr 3 09:38:06 CEST 2009


On 03 Apr 2009, at 02:34, Markus Glugla wrote:

> I need the available memory (heap). At that time the functions  
> maxavail
> or memavail did this. I read that I should use GetFPCHeapStatus and
> other function currently.
>
> This functions produce allways zero!! What can I do? What is wrong?
> I use fpc version 2.2.0 [2008/05/27] for i386.

On which OS? And what happens if you allocate some memory at the start  
of your program?

Anyway, even if it would return non-zero values, the information would  
be next to useless. The reason is that on modern OS'es, available  
physical memory is dynamically divided between the disk cache and  
applications, with a lower limit on the disk cache. What would you  
expect memavail to report? The current amount of really "free" memory?  
Free + cache? Free + part of cache? Free + non-wired (i.e., swappable)  
+ part of cache? Free + non-wired + part of cache + swap space?

The information provided by GetFPCHeapStatus is only useful to get  
statistics about the heap manager, and not to get any information  
about the system you are running on.


Jonas



More information about the fpc-pascal mailing list