This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Determining Physical and Virtual Memory At Runtime In C
- From: Jonathan Schreiter <jonathanschreiter at yahoo dot com>
- To: zippo <zippo752001 at comcast dot net>, gcc-help at gcc dot gnu dot org
- Date: Fri, 14 Apr 2006 10:05:45 -0700 (PDT)
- Subject: Re: Determining Physical and Virtual Memory At Runtime In C
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?
Jonathan
--- zippo <zippo752001@comcast.net> wrote:
> $top all you need and more
>
> On Fri, 14 Apr 2006 08:41:39 -0700 (PDT)
> Jonathan Schreiter <jonathanschreiter@yahoo.com>
> wrote:
>
> > Hi,
> > Can anyone point me in the direction on a
> relatively
> > simple way to determine the amount of physical
> memory
> > and virtual memory available on a system at
> runtime?
> > I'd like to be able to determine each value
> > independently, not the sum of both (total
> available
> > memory).
> >
> > I'd like to differentiate between the two in a c
> > program (gcc 4) in x86_64 linux (although that
> > shouldn't matter).
> >
> > Memalloc works fine, but performance slows down if
> > large arrays allocate in the upper paging file
> memory.
> > I'd like to be able to split up calculations
> relative
> > to the available memory results returned.
> >
> > Any help would be greatly appreciated.
> >
> > Thanks,
> > Jonathan
> >
>