Getting Free RAM

Waspmote Files

Inside the Core directory we can find both MemoryFree.cpp and MemoryFree.h which develop the function that allows the user to get the available free memory in Waspmote\'s RAM.

FreeMemory() function

This is the function that returns the Waspmote\'s available memory in bytes.
Waspmote RAM
data Variables
.bss Variables
Heap →
Free Memory
← Stack
Figure: RAM Memory spaces
The different sections in RAM are explained below:
  • .data variables/.bss variables: Memory space for initialized and uninitialized variables.
  • Heap: Memory space for dynamic memory allocation.
  • Stack: Memory space used for calling subroutines and storing local (automatic) variables. This memory space grows downwards.
Example of use:
USB.print(\"free Memory (Bytes):\");
USB.println(freeMemory()); // prints free RAM