C
Christophe Lohr
Hi,
Inside a program, I need to get some statistics about memory usage.
I actually need figures given by the "ps -o vsr,rss" command.
For the moment, I make a popen("ps...") followed of a scanf on what it
displays. It is a little complicated, and that distorts measurements.
Is there a better way?
I have tried "getrusage()". However values returned are not really
relevant for my needs.
I also looked at "mallinfo()", without success.
First, I do not know what is that a "block" (which size ?). Then, that does
not count the stack size and the code size, just the malloc.
(By the way, it's more or less a C++ code. So, are the "new" counted in
mallinfo() ?)
Then, how can my program know its "resident set size" and especially its
"virtual memory size"?
Thanks.
Christophe
Inside a program, I need to get some statistics about memory usage.
I actually need figures given by the "ps -o vsr,rss" command.
For the moment, I make a popen("ps...") followed of a scanf on what it
displays. It is a little complicated, and that distorts measurements.
Is there a better way?
I have tried "getrusage()". However values returned are not really
relevant for my needs.
I also looked at "mallinfo()", without success.
First, I do not know what is that a "block" (which size ?). Then, that does
not count the stack size and the code size, just the malloc.
(By the way, it's more or less a C++ code. So, are the "new" counted in
mallinfo() ?)
Then, how can my program know its "resident set size" and especially its
"virtual memory size"?
Thanks.
Christophe