Page 1 of 1

running out of internal heap RAM

Posted: Mon Sep 29, 2025 8:08 am
by aygh4266
Hello everyone,

We are using the ESP32-S3 with external 8 MB PSRAM. Our application currently runs many tasks (UART, NimBLE, Wi-Fi, USB MSC mounting task, and an OTA update task). We also have an additional task that handles switching between NimBLE and Wi-Fi, so that Wi-Fi is stopped while NimBLE is advertising, and vice versa.

At the moment, we are running into RAM limitations, even though we allocate uninitialized variables and objects in PSRAM using EXT_RAM_BSS_ATTR. I am monitoring the high-water marks of the tasks to avoid over-allocating stack depth and to save more internal RAM. The tasks are created with xTaskCreatePinnedToCoreWithCaps so that they are allocated directly in PSRAM.

Unfortunately, the USB MSC is not working properly due to internal RAM exhaustion. Do you have any advice on how to manage this more effectively? For example, is it possible not only to stop Wi-Fi or the web server, but also to completely suspend the Wi-Fi task when it is not being used? Wi-Fi alone consumes at least 90 KB of internal RAM.

Greetings

Re: running out of internal heap RAM

Posted: Mon Sep 29, 2025 10:52 am
by MicroController
even though we allocate uninitialized variables and objects in PSRAM
Check if you have any malloc() calls you could replace with heap_caps_malloc() to put more stuff into PSRAM.
is it possible not only to stop Wi-Fi ...
esp_wifi_deinit()?

Also: https://docs.espressif.com/projects/esp ... -wifi-lwip