https://github.com/erriez/erriezmemoryusage
Memory usage library for Arduino
https://github.com/erriez/erriezmemoryusage
arduino avr debug diagnostics documentation examples free library memory memory-allocation uno usage
Last synced: 21 days ago
JSON representation
Memory usage library for Arduino
- Host: GitHub
- URL: https://github.com/erriez/erriezmemoryusage
- Owner: Erriez
- License: mit
- Created: 2018-01-14T13:20:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-28T16:10:33.000Z (almost 5 years ago)
- Last Synced: 2025-04-06T21:33:49.309Z (3 months ago)
- Topics: arduino, avr, debug, diagnostics, documentation, examples, free, library, memory, memory-allocation, uno, usage
- Language: C++
- Homepage: https://github.com/Erriez/ErriezArduinoLibrariesAndSketches
- Size: 524 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Memory Usage library for Arduino AVR targets
[](https://travis-ci.org/Erriez/ErriezMemoryUsage)This Arduino library prints memory usage on the Serial port.

## 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:
* [PrintMemoryUsage](https://github.com/Erriez/ErriezMemoryUsage/blob/master/examples/ErriezPrintMemoryUsage/ErriezPrintMemoryUsage.ino)
## Documentation
* [Doxygen online HTML](https://erriez.github.io/ErriezMemoryUsage)
* [Doxygen PDF](https://github.com/Erriez/ErriezMemoryUsage/raw/master/ErriezMemoryUsage.pdf)### Print memory usage on serial port
```c++
void setup()
{
// Initialize serial port
Serial.begin(115200);
// Print memory usage
printMemoryUsage();
}
```#### Output serial port Arduino Uno
```c++
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:
```c++
unsigned int ramSize = getRamSize();
```### Get free memory
Get free memory size which can be allocated between stack and heap:
```c++
unsigned int freeMemSize = getFreeMemSize();
```### Get stack size
```c++
unsigned int stackSize = getStackSize();
```### Get heap size
```c++
unsigned int heapSize = getHeapSize();
```### Get .data section size
```c++
unsigned int dataSize = getDataSectionSize();
```### Get .bss section size
```c++
unsigned int bssSize = getBssSectionSize();
```## Library installation
Please refer to the [Wiki](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches/wiki) page.
## Other Arduino Libraries and Sketches from Erriez
* [Erriez Libraries and Sketches](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches)