Skip to content

Instantly share code, notes, and snippets.

View gbmhunter's full-sized avatar

Geoffrey Hunter gbmhunter

View GitHub Profile
@gbmhunter
gbmhunter / GetLinuxProcessMemoryCpp.cpp
Last active August 29, 2021 18:47
Code example showing how to get the memory used by the current Linux process in C/C++.
#include "sys/types.h"
#include "sys/sysinfo.h"
int parseLine(char *line) {
// This assumes that a digit will be found and the line ends in " Kb".
int i = strlen(line);
const char *p = line;
while (*p < '0' || *p > '9') p++;
line[i - 3] = '\0';
i = atoi(p);
.cpu cortex-a9
.eabi_attribute 28, 1
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 2
.eabi_attribute 34, 1