What is SRAM ?

Your Arduino uses a specific memory called SRAM (Static Random-Access Memory) to store program variables and to manage interrupts and function calls while your program is running. The bigger your code is, the more memory it uses. This memory is volatile, which means it retains data while your Arduino is powered on and lose this data when power is cut off.

The occupied memory area used to run your program is divided into specialized sections which are all different. Each section either holds a specific type of data or has a specific use:

  • Stack - for Interrupts and function calls management (call pointers, call orders, function parameters, local variables)
  • Heap - for dynamically allocated data (with keyword “new”, or function malloc())
  • .bss section - for uninitialized global or static variables
  • .data section - for initialized global or static variables

The size of a section depends on your code and may vary while your program is running. At power on, global and static data are loaded from the non-volatile Program (Flash) Memory to the .bss and .data sections of the SRAM. When your program runs, the Heap and the Stack grow or shrink depending on the code being executed.

The remaining unused memory area is called the Free RAM. This Free RAM will reach zero if you ever run out of memory. You should always ensure this never happens (avoid having less than 150 bytes left). If it does, your code will stop working correctly and you will encounter very tricky bugs.

Refer to this section to see how to identify SRAM shortage and how to save SRAM memory.


  1. SRAM is a specific type of RAM. Thus, those 2 words SRAM and RAM are commonly used interchangeably but they refer to the same thing.
  2. Check out this excellent article from Adafruit to learn more about the SRAM.


Was this article helpful?
0 out of 0 found this helpful