0

I'm trying to get a process's memory and time usage,and here is [my code] but the memory reported is so much for such a simple app consuming almost 8500Kb. Has something I've done reported the wrong memory usage or are there other reasons?

#include "trace.h"
#include "include.h"
#include "trace.cpp"
using namespace std;
int main(int argc, const char * argv[])
{
    trace t;
    t.SetLimitInfo();
    t.CreateProcess();
    t.waitForChild();


    cout<<"time usage: "<<t.getTime()<<"ms memory usage: "<<t.GetMemory()<<"kb"<<endl;
    // insert code here...
//    std::cout << "Hello, World!\n";
    return 0;
}
GJKH
  • 1,715
  • 13
  • 30
Jialin
  • 2,415
  • 2
  • 14
  • 10

1 Answers1

0

I would use valgrind --tool=massif to check memory usage.

Check the doc

edwardtoday
  • 363
  • 2
  • 14