I'm trying to measure the maximum resident set size and I found that you can do so with getrusage:
- https://linux.die.net/man/2/getrusage
- http://pubs.opengroup.org/onlinepubs/009695399/functions/getrusage.html
When I run this
#include <iostream>
#include<vector>
#include <sys/resource.h>
using namespace std;
int main(int argc, char* argv[]){
int who = RUSAGE_SELF;
struct rusage usage;
int ret = -1;
vector<int> v(1024);
ret = getrusage(who, &usage);
if (ret == 0) cout << usage.ru_maxrss << endl;
return 0;
}
I get the same value as I do when I comment the declaration of the vector.
Is there anything I'm doing wrong?
Thanks!