Query available heap memory.
- Returns
- HeapInfo struct with free SRAM and PSRAM bytes
Platform implementations:
- ESP32: Reports both SRAM (heap_caps_get_free_size(MALLOC_CAP_INTERNAL)) and PSRAM (heap_caps_get_free_size(MALLOC_CAP_SPIRAM)) if available
- ESP8266: Reports SRAM only (no PSRAM support)
- AVR: Reports available SRAM between heap and stack (no PSRAM)
- ARM: Platform-dependent (SRAM only, no PSRAM)
- Native/Stub: Returns {0, 0} (heap size not available in standard C++)
- WASM: Returns {0, 0} (JavaScript heap is managed externally)
Usage:
}
}
HeapInfo getFreeHeap()
Query available heap memory.
bool has_psram() const
Check if PSRAM is available.
fl::size free_sram
Free SRAM in bytes (internal fast memory)
Definition at line 67 of file heap.cpp.hpp.
67 {
71 return info;
72}
fl::size free_psram
Free PSRAM in bytes (external slower memory, 0 if not available)
References fl::HeapInfo::free_psram, and fl::HeapInfo::free_sram.