[fpc-pascal] Memory Size

Markus Glugla fpc at xgelb.de
Fri Apr 3 12:36:16 CEST 2009


Hi Jonas,

thank you for your answer.

> On which OS?
Debian 5.0 GNU/Linux (uname -r: 2.6.26-1-686)

> 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.
...
> 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.
I have misunderstood this. Ok, thank you.

> And what happens if you allocate some memory at the start of your program?
> 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?
I need the really "free" memory. I would use the maximal available free
 working memory (no swap or so) because I need a program-internal quick
 (very very quick) memory as a cache as soon as practicable. I would  
 cache streams of measurement values (single type, sample rate circa  
 32KHz). The measurement program will run on diffrent machines with
 diffrent RAM. Depending on the free memory the number of measurement
  values or the measurement times are diffrent. The reason to know the
 free  memory is to decide what or how should I measure. All buffered
  prints  into a file are to slow and produce underruns. My idea is to 
   stream  the  measurement values into an array and write the array on
  disk  after the measurement. To do this I must know the memory ;-)

 Is there a other way to get the free memory size?

Thanks
Markus




More information about the fpc-pascal mailing list