⚡
usefultools.dev
RAM

Arduino Memory Estimator (SRAM for Globals)

NOVO

Arduino memory estimator: paste your sketch globals to estimate SRAM use per board, with struct sizes, a 75 % warning and F() / PROGMEM savings tips.

Funciona 100% no seu navegador — o que você insere nunca é enviado nem armazenado nos nossos servidores.

Esta ferramenta ainda não está totalmente traduzida, por isso parte do texto continua em inglês. A ferramenta funciona da mesma forma em todos os idiomas.

ATmega328P: 2 KB SRAM · int 2 B · double 4 B · pointer 2 B · const data and string literals go to SRAM unless PROGMEM / F()

Estimated static SRAM: 362 B of 2048 B
17.7 %
Globals: 339 B
Literals in SRAM: 23 B
Flash data: 256 B
String heap: ~5 B

Wrap the 2 print literals in F(), e.g. Serial.println(F("text")), to save ≈ 23 B of SRAM.

LineNameTypeBytesWhereNote
4LED_PINint2—compile-time constant — usually optimised away
5readingsint[10]20SRAM
6temperaturefloat4SRAM
7averagedouble4SRAM
8lastSendunsigned long4SRAM
9bufferchar[BUF_LEN]64SRAM
10greetingchar[16]16SRAM
11nameschar *[3]6SRAM
11names literalsstring literal15SRAMstring literals live in SRAM on this board
12tableuint8_t[256]256FlashPROGMEM — read it with pgm_read_*() / strcpy_P()
13statusString6SRAMtext copied to heap at startup
13status literalstring literal5SRAMstring literals live in SRAM on this board
14flagsbool[8]8SRAM
14readybool1SRAM
17pathPoint[20]180SRAM
20modesMode[MODE_COUNT]6SRAM
—literals in functions2 unique23SRAM1 already in F()/PSTR(); identical literals are usually merged

Struct sizes on this board: Point = 9 B (AVR: no padding).

Not counted / approximated
  • Line 22: Servo myServo — size of “Servo” is unknown (library class?) — not counted. Paste its struct/class definition to include it.

This is an estimate of static data for globals only. Local variables (stack), heap allocations (String, new, malloc), the Arduino core (e.g. Serial buffers) and libraries add more — the IDE's “Global variables use …” line after compiling is the authoritative number. Verify type sizes against your board's core.

⚡

Exemplos rápidos

Entradas típicas e os resultados que esta ferramenta gera.

AVR int = 2 B
int readings[10]; on Uno
20 B (0.98 % of 2 KB)
32-bit int
int readings[10]; on ESP32
40 B
AVR double
double samples[50]; on Uno
200 B (double = 4 B)
Padding
struct {int16_t ×2, uint8_t, float}
Uno 9 B · ESP32 12 B
Warning
char buf[1600]; on Uno
78.13 % — over 75 % warning
📖

Visão geral

An Arduino Uno has only 2 KB of SRAM for global variables, the heap and the stack together. When globals take too much, the sketch still compiles but crashes or resets at random once the stack grows into your data. Type sizes also differ between boards: an int is 2 bytes and a double only 4 bytes on AVR, but 4 and 8 bytes on ESP32, Due or Pico, where structs gain alignment padding as well.

This Arduino memory estimator parses the global declarations you paste — scalars, arrays, #define and const array sizes, char strings, String objects, structs, enums and typedefs — and adds up their size with the ABI of the selected board. It shows where each item lives (SRAM or flash), counts string literals used in your functions, warns above 75 % and suggests F() and PROGMEM savings. It is an estimate: heap, stack and library usage are not included, and nothing leaves your browser.

Por que usar esta ferramenta?

  • Catch SRAM overflows before random resets
  • Board-correct sizes for int, double, pointers and structs
  • Find string literals that F() would move to flash
  • Compare the same sketch on Uno, Mega, ESP32 or Pico
  • Private: your code never leaves the browser
⭐

Recursos

🧠

Per-board ABI

Uses the int, double, pointer and String sizes of the selected board, with padding on 32-bit cores.

📐

Arrays & structs

Resolves #define, const and enum array sizes, initializer lists, nested structs, unions and bitfields.

🔤

String literal check

Counts print() literals not wrapped in F() and const tables that should be PROGMEM.

📊

Usage bar & warnings

Shows the share of SRAM used and warns above the IDE’s 75 % threshold.

🧾

Line-by-line table

Every global with its type, bytes, SRAM/flash location and a note; unknown types are listed separately.

📋

Copy report

Copy a plain-text summary to paste into an issue or forum post.

🛠️

Como usar

1

Choose the board

Pick your board so type sizes and the SRAM limit match.

2

Paste your code

Paste the whole sketch or just its global declarations; function bodies are skipped.

3

Review the estimate

Check the usage bar, the per-variable table and anything listed as not counted.

4

Apply the tips

Wrap literals in F(), move tables to PROGMEM, then copy the report.

🤔

Perguntas frequentes