Utilities Programming Guide
Development website
  • Initial page
  • Introduction
  • USB Library
  • Utilities Library
  • Input/Output pins
  • Getting Free RAM
  • Reading basic sensors
  • Waspmote Stack EEPROM
  • Code examples and extended information
  • API changelog
Powered by GitBook
On this page
  • Waspmote Files
  • FreeMemory() function

Was this helpful?

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
}
PreviousInput/Output pinsNextReading basic sensors

Last updated 4 years ago

Was this helpful?

Getting free memory example:

http://www.development.libelium.com/ut-05-get-free-memory