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;
}
4

1 回答 1

0

我会valgrind --tool=massif用来检查内存使用情况。

检查文档

于 2014-03-12T01:37:09.533 回答