Getting Free RAM
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.
This is the function that returns the Waspmote\'s available memory in bytes.
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