A
Alessandro Basili
I'm facing a memory problem, since from time to time the memory usage of
my program (shown with ps and/or top utilities) increases.
I'm aware of the getrusage function from the GNU C library, but
unfortunately the kernel we are using (linux 2.6) is not supporting the
fields for memory usage in the rusage structure.
Through some research I start to use the /proc file system and the statm
file related to the pid of the running program.
Now I have inserted throughout the program several calls to a function
that prints the statistics from the statm file in order to isolate the
increase of memory usage.
Unfortunately the result points to a part of the program that does not
have any hidden ambiguities related to memory usage, which is also
confirmed by isolating it in a test program.
What I would like to understand is if the system calls to update statm
may be totally asynchronous with the current program flow (buffering,
threading??) and if that is the case how can I get the usage of the
memory reliably.
Thanks for any suggestion.
Al
my program (shown with ps and/or top utilities) increases.
I'm aware of the getrusage function from the GNU C library, but
unfortunately the kernel we are using (linux 2.6) is not supporting the
fields for memory usage in the rusage structure.
Through some research I start to use the /proc file system and the statm
file related to the pid of the running program.
Now I have inserted throughout the program several calls to a function
that prints the statistics from the statm file in order to isolate the
increase of memory usage.
Unfortunately the result points to a part of the program that does not
have any hidden ambiguities related to memory usage, which is also
confirmed by isolating it in a test program.
What I would like to understand is if the system calls to update statm
may be totally asynchronous with the current program flow (buffering,
threading??) and if that is the case how can I get the usage of the
memory reliably.
Thanks for any suggestion.
Al