PDA

View Full Version : C++ Program MAXIMUM memory usage



DBQ
June 16th, 2008, 09:25 PM
I have asked this question before elsewhere, but was never able to get a good answer. Basically I would like to be able to determine the maximum memory usage of the C++ program. I either would like to do it inside the program itself (in a simple way - several lines of code), or using a script. I know there is getrusage() system call, but it does not take into account only resident memory, not swap (correct?). Also, ps can provide the memory usage, but not maximum (correct?). Any ideas?