RAM
Waspmote's microcontroller includes an 8 kB SRAM which is shared between initialized and uninitialized variables, the dynamic memory allocator, and the stack that is used for calling subroutines and storing local variables.
It is a good practice to delete variables which have already been used. This will avoid confusion, like "is this old or new?".
Also, once a vector has been used, it is good to delete all the fields in this vector, by writing 0's or voids, for example.
Avoid using strings so as to save memory. When printing debug messages use the Flash memory to allocate those messages:
Avoid using dynamic memory allocation in order to prevent memory fragmentation. It is preferable to use controlled static variables.
It is possible to get the free memory by calling the function
freeMemory
:
Last updated