#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>

void getSize(long int *val) {
  struct rusage usage;

  getrusage(RUSAGE_SELF, &usage);

/* These are all Zero
  *val = usage.ru_ixrss+usage.ru_idrss+usage.ru_isrss;
  printf("Current IX %ld \n", usage.ru_ixrss);
  printf("Current ID %ld \n", usage.ru_idrss);
  printf("Current IS %ld \n", usage.ru_isrss);
  printf("Current sum  %ld \n", *val);
*/ 
  *val = usage.ru_maxrss;
//  printf("Max     %ld \n", *val);

}
