Determining Physical and Virtual Memory At Runtime In C

Brian Dessent brian@dessent.net
Fri Apr 14 17:11:00 GMT 2006


Jonathan Schreiter wrote:

> Thanks for the reply, but I'm looking for a way to
> programmatically determine the memory from inside the
> C program.  I suppose one could execute a shell
> statement and bring that data back in to C, but I'd
> like a simpler approach that does not rely on top.  Am
> I perhaps missing something?

You're asking on the wrong place.  This has nothing to do with gcc
itself.  It is target/platform specific.  On linux you can just open()
the appropriate file under /proc and read the values.  But that is not
going to be very portable.

Brian



More information about the Gcc-help mailing list