|
getrusage and process memory usage
hello,
I'm using getrusage to tell me how much stack space I'm using as I go through a series of recursive calls. Heres the code :
struct rusage usage ;
if(getrusage(RUSAGE_CHILDREN, &usage) != 0)
{
cout<<"getrusage failed"<<endl ;
exit(0);
}
cout<<"Shared Memory = "<<usage.ru_ixrss<<endl ;
cout<<"Unshared Data Size = "<<usage.ru_idrss<<endl ;
cout<<"Unshared Stack Size = "<<usage.ru_isrss<<endl ;
However each of the outputs only produces a zero. The program I'm running will use well over 2 gigs of ram (sometimes more...argh!). I'm trying to eliminate superfluous variables by this kind if analysis.
Can anyone tell me why getrusage isn't detecting the stack space I'm using and / or alternative methods of extracting the info I'm looking for.
Cheers,
Gearoid
|