Get process memory consumption this question is about getting the memory usage of running program. I need to know how much RAM a program has used after it has finished.
Say I am compiling a C++ program with this command g++ main.cpp
. I need to know how much memory this used after it has finished. Or, if memory can only be measured for a specific instant, I need to know what is the maximum RAM usage when compiling a program.
For any program I passed to /usr/bin/time -f "%M"
, I get max resident value 0. I am sure that my program uses gigabytes of memory