Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.
Compile error · RAM

Fix “data section exceeds available space in board” (Uno/Nano)

Global variables use more than the Uno’s 2048 bytes of RAM. Move text into flash with F(), shrink arrays and buffers, or move to a Mega or ESP32.

Arduino UnoArduino NanoArduino Pro MiniUpdated 3 Nov 2026

Community draft — report a mistake

What you see

OutputOutput
Sketch uses 1696 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 2288 bytes (111%) of dynamic memory, leaving -240 bytes for local variables. Maximum is 2048 bytes.
Not enough memory; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing your footprint.
data section exceeds available space in board

Compilation error: data section exceeds available space in board

The ATmega328P on an Uno or Nano has 2048 bytes of RAM for every global variable, every string literal not wrapped in F(), and the stack. When the globals alone are larger, the build stops with this message.

Serial.println("Water level sensor ready");      // 25 bytes of RAM
Serial.println(F("Water level sensor ready"));   // 0 bytes of RAM

Quick fix — try in order

  1. 1

    Wrap fixed text in F()

    Serial.println(F("Sensor not found")); and lcd.print(F("Tank level"));. Without F(), every string literal is copied into RAM at start-up.

  2. 2

    Shrink arrays and buffers

    A byte log[1000] or int readings[500] eats half the Uno. Use byte instead of int where values fit 0–255, and keep only the samples you need.

  3. 3

    Put constant tables in PROGMEM

    const uint8_t table[] PROGMEM = {…}; and read with pgm_read_byte(&table[i]).

  4. 4

    Check library buffers

    Some libraries reserve big buffers: SD (~600 B), an SSD1306 128×64 (1 KB at runtime), WS2812 (3 B per LED). Two of them together rarely fit an Uno.

  5. 5

    Change board if the project is simply bigger

    Mega 2560 has 8 KB RAM; ESP32 has over 300 KB. Often cheaper than hours of trimming.

Why it happens

Which number matters?

“Global variables use … of dynamic memory”. Over 100% fails to build; over ~75% builds but may crash at runtime — see Low memory available.

Flash is only 5% used — why does it fail?

Flash (program storage) and RAM (dynamic memory) are separate. Code goes to 32 KB flash; variables go to 2 KB RAM.

Same message on other boards

Any AVR board prints this when globals exceed its RAM: ATtiny85 (512 B), Leonardo (2.5 KB), Mega (8 KB).

Board-specific notes

Arduino Uno: Leave at least 300–400 bytes free for local variables and the stack.

SSD1306: The OLED buffer is allocated at runtime, so it isn’t in this number — a sketch that barely fits can still fail with SSD1306 allocation failed.

↑↓ to move · Enter to open