Heap Memory Exhausted
Espressif ESP32
Severity:What Does This Error Mean?
ESP32 heap memory exhausted means your code tried to allocate more RAM than is available. The ESP32 has about 300 KB of usable heap. Free memory after use, avoid large global arrays, and use PSRAM-equipped boards for image or audio buffers.
Affected Models
- ESP32-DevKitC
- ESP32-WROOM-32
- ESP32-S3
- ESP32-C3
- All ESP32 variants
Common Causes
- Large global arrays or buffers declared in RAM
- Memory fragmentation from repeated malloc/free cycles
- String concatenation building up large strings in memory
- Libraries allocating large internal buffers (WiFi, camera, BLE)
- Memory leak — allocated memory never freed