Erriez / ErriezMemoryUsage

Memory usage library for Arduino

Home Page:https://github.com/Erriez/ErriezArduinoLibrariesAndSketches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Usage library for Arduino AVR targets

Build Status

This Arduino library prints memory usage on the Serial port.

Memory usage

Features

This library provides:

  • Print memory usage on the serial console
  • Get stack and heap size
  • Get .data and .bss sections size

Examples

Arduino IDE | Examples | Erriez Memory Usage:

Documentation

Print memory usage on serial port

void setup()
{
  // Initialize serial port
  Serial.begin(115200);
  
  // Print memory usage
  printMemoryUsage();
}

Output serial port Arduino Uno

SRAM size:  2048 Bytes
.data size: 22 Bytes
.bss size:  170 Bytes
Stack size: 2 Bytes
Heap size:  0 Bytes
Free mem:   1854 Bytes

Get RAM size

Get total on-chip SRAM size in Bytes:

unsigned int ramSize = getRamSize();

Get free memory

Get free memory size which can be allocated between stack and heap:

unsigned int freeMemSize = getFreeMemSize();

Get stack size

unsigned int stackSize = getStackSize();

Get heap size

unsigned int heapSize = getHeapSize();

Get .data section size

unsigned int dataSize = getDataSectionSize();

Get .bss section size

unsigned int bssSize = getBssSectionSize();

Library installation

Please refer to the Wiki page.

Other Arduino Libraries and Sketches from Erriez

About

Memory usage library for Arduino

https://github.com/Erriez/ErriezArduinoLibrariesAndSketches

License:MIT License


Languages

Language:C++ 67.5%Language:C 32.5%