Page 1 of 1
WiFi cannot allocate memory in SPIRAM when ISRAM is full
Posted: Fri May 24, 2019 7:04 am
by philippe_44
I have an application that allocates lots of mid that were below SPIRAM threshold SPIRAM_MALLOC_ALWAYSINTERNAL. The Wifi driver was failing regularly its memory alloc (and then disconnecting) and I realized that it was happening once the internal memory was consumed by my other applications. Moving SPIRAM_MALLOC_ALWAYSINTERNAL to 2048, which is way below most of my application blocks, the problem went away.
1/ reading the the doc, the WiFi alloc shall not fail, but shall try SPIRAM then
2/ I've set the NEW option to allocate WiFI to SPIRAM first and then fallback to internal and it does not seem to work
I Have the 64MBits SPIRAM, with 1.7MB available
Re: WiFi cannot allocate memory in SPIRAM when ISRAM is full
Posted: Sun Jun 23, 2019 8:13 pm
by thethinker
I have the same issue. As soon as I enable the option for Wifi and LWIP stack to allocate from PSRAM, weird things such as WiFi not connecting starts happening. Were you ever able to figure this out?
Re: WiFi cannot allocate memory in SPIRAM when ISRAM is full
Posted: Wed Jul 03, 2019 4:49 pm
by philippe_44
Yes, I had to lower the minimum block size that was *always* allocated to internal RAM (CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL) so that my application would not allocate too much of the internal ram as WiFi *wants* some of its allocation to be in internal ram, regardless of WiFi memory allocation strategy settings
Re: WiFi cannot allocate memory in SPIRAM when ISRAM is full
Posted: Wed Sep 18, 2024 10:44 am
by Jonathan2892
Hi,
we are running in the same issue on esp32-s3 and idf 5.3.1, but with the mqtt client.
We have 5 Tasks of our own with total stack sizes 3kB to 6 kB (total stack size: 19kB). Then we use wifi and mqtt, so these esp-internal tasks are also running.
We also have a lot of const maps.
After changing SPIRAM_MALLOC_ALWAYSINTERNAL to 2048 everything works fine.
Is this the proper way? What is the suggestion from espressif or explanation for this behaviour?
Best
Jonathan