ESP系列内存剩余
内存查询方式
在需要查看内存剩余时,直接调用函数并打印返回值即可
ESP_LOGI(TAG, ">>>>>> free_heap: %d", esp_get_free_heap_size());
ESP_LOGI(TAG, ">>>>>> minimum_free_heap: %d", esp_get_minimum_free_heap_size());
or
printf(">>>>>> free_heap: %d\n", esp_get_free_heap_size());
printf(">>>>>> minimum_free_heap: %d\n", esp_get_minimum_free_heap_size());
TIPS
↓↓↓测试例程链接↓↓↓
hello_world: https://github.com/espressif/esp-idf/tree/release/v5.3/examples/get-started/hello_world
wifi
station: https://github.com/espressif/esp-idf/tree/release/v5.3/examples/wifi/getting_started/station
softap: https://github.com/espressif/esp-idf/tree/release/v5.3/examples/wifi/getting_started/softAP
ble
gatt_server: https://github.com/espressif/esp-idf/tree/release/v5.3/examples/bluetooth/bluedroid/ble/gatt_server
gatt_client: https://github.com/espressif/esp-idf/tree/release/v5.3/examples/bluetooth/bluedroid/ble/gatt_client
芯片RAM大小
数据来源于乐鑫官方技术规格书。
ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 | ESP32P4 |
---|
520KB | 320KB | 400KB | 512KB | 272KB | 512 KB | 320KB | 768KB |
hello_world
ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 | ESP32P4 |
---|
298KB | 244KB | 322KB | 380KB | 192KB | 454KB | 259KB | 597KB |
单WiFi(未连接)
STA
ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 |
---|
228KB | 135KB | 222KB | 280KB | 107KB | 326KB |
AP
ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 |
---|
216KB | 123KB | 210KB | 269KB | 95KB | 314KB |
单WiFi(保持连接)
STA
ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 |
---|
224KB | 134KB | 221KB | 279KB | 106KB | 324KB |
AP
1、2 表示当前连接的 STA 设备数量
| ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 |
---|
1 | 212KB | 119KB | 206KB | 265KB | 91KB | 310KB |
2 | 208KB | 115KB | 202KB | 261KB | 88KB | 306KB |
单BLE(未连接)
server
ESP32 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 |
---|
201KB | 216KB | 275KB | 81KB | 358KB | 149KB |
client
ESP32 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 |
---|
202KB | 217KB | 277KB | 82KB | 360KB | 152KB |
单BLE(保持连接)
server
ESP32 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 |
---|
197KB | 213KB | 272KB | 78KB | 353KB | 144KB |
client
ESP32 | ESP32C3 | ESP32S3 | ESP32C2 | ESP32C6 | ESP32H2 |
---|
198KB | 213KB | 272KB | 78KB | 353KB | 144KB |