Skip to content

Instantly share code, notes, and snippets.

int memory_usage(){
char buf[30];
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
FILE * file = fopen(buf, "r");
setbuf(file, NULL);
unsigned res;
if(file)
fscanf(file, "%u", &res);
fclose(file);