OT: How to find amount of free memory from within a C program

Ranjan Maitra maitra at iastate.edu
Sun Sep 11 19:54:59 UTC 2011


Dear friends,

This is a general question with the exception that I use Fedora
exclusively:-) Besides, this -- along with R-help -- are the two most
knowledgeable and helpful mailing lists I know of.

In any case, is there a ready way (function or such) to find out how
much memory is available to me from inside a C program? I would like
this to be as generic as possible.

I tried getrusage() but I could not figure out if there was a field for
free/available memory in the rusage struct. In fact, there does not
seem to be. 

Any other suggestions?

Many thanks again for this OT help, and best wishes,
Ranjan



More information about the users mailing list