-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory allocation issues (IDFGH-2698) #4769
Comments
esp-idf/components/spi_flash/esp_flash_api.c Line 501 in caa59da
esp-idf/components/spi_flash/esp_flash_api.c Line 519 in caa59da
Should be MIN not MAX |
Hi @negativekelvin , thank you. Could this be fixed in |
@enricop We will fix this ASAP and backport for previous applicable release branches as well. |
…ash to PSRAM buffers Previously would try allocate buffer of minimum size 16KB not maximum size 16KB, causing out of memory errors for any large reads, or if less than 16KB contiguous free heap. Also, if using legacy API and internal allocation failed then implementation would abort() instead of returning the error to the caller. Added test for using large buffers in PSRAM. Closes #4769 Also reported on forum: https://esp32.com/viewtopic.php?f=13&t=14304&p=55972
…ash to PSRAM buffers Previously would try allocate buffer of minimum size 16KB not maximum size 16KB, causing out of memory errors for any large reads, or if less than 16KB contiguous free heap. Also, if using legacy API and internal allocation failed then implementation would abort() instead of returning the error to the caller. Added test for using large buffers in PSRAM. Closes #4769 Also reported on forum: https://esp32.com/viewtopic.php?f=13&t=14304&p=55972
+1 opening this issue following all the threads which have led me here W (198897) wifi:alloc eb len=24 type=3 fail, heap:0 W (198897) wifi:m f null |
@rebeliousconformist This doesn't seem to be the same as the issue reported above. The log message indicates that Wi-Fi is failing to allocate 24 bytes from internal memory because there is no free heap remaining ("heap:0" indicates zero bytes available). If you think this is an issue in ESP-IDF, rather than the firmware is running out of free memory, then please open a new issue with the extra details shown in the issue template. If you suspect a memory leak somewhere, there are some tips for heap memory debugging here: https://docs.espressif.com/projects/esp-idf/en/release-v4.1/api-reference/system/heap_debug.html# |
@projectgus yes. ill report them if i do find any bugs. The dearth of heap memory has occured after updating to the latest commit. In the past it has so occured that i have spent days debugging and after i found the bug, it was fixed in the next commit. Hence my post to make sure im not running blind. |
Dear support,
we're facing some memory allocation issues with our ESP-WROVER based BLE Mesh IoT gateway.
We're currently trying to assess the limits of our system by increasing the number of mesh nodes and devices connected to our ESP32.
Everything is going pretty good so far, except for a few sporadic crashes, whose origin we determined to be related to our chronical shortage of internal memory.
We've seen several times this pattern occurring:
We have a strong suspicion that this error could origin from the following code:
esp_flash_api.c:
It seems like that due to the conflict between SPI RAM access and NVS reads if the destination buffer is not in DRAM (and given we've set SPIRAM_MALLOC_ALWAYSINTERNAL=256, almost all big allocations are in SPIRAM) the function attempts to allocate an at least 16KiB temporary buffer from internal memory; this operation always fails because of our 25k of free internal memory are very fragmented.
Do you have any tips about how to avoid this issue? We've already tried freeing up as much internal memory as possible. In particular, we would like to know if you can recommend some methods to prevent or at least mitigate memory fragmentation.
Thank you in advance for your support.
The text was updated successfully, but these errors were encountered: