ESP32 Generic: ESP-IDF v4.4 throws exception allocation errors (`MemoryError: memory allocation failed`)
Building ESP-32 GENERIC board using ESP-IDF v4.4 (142bb32c50fa9875b8b69fa539a2d59559460d72) throws memory allocation errors upon py file imports:
Traceback (most recent call last):
File "main.py", line 62, in <module>
File "uasyncio/core.py", line 1, in run
File "uasyncio/core.py", line 1, in run_until_complete
File "uasyncio/core.py", line 1, in run_until_complete
File "main.py", line 38, in setup
File "./sargs.py", line 70, in setup
File "./sargs.py", line 80, in _init_lcd
File "./ssd1306.py", line 113, in __init__
MemoryError: memory allocation failed, allocating 1025 bytes
MicroPython 11ab899 on 2022-02-10; ESP32 module with ESP32
Type "help()" for more information.
Cannot reproduce with ESP-IDF v4.0.2 and also with v4.2.2 everything is fine.
THREADS: MemoryError: memory allocation failed
Hello,
First I want to say sorry about posting kind of issue since they are hard to reproduce.
Here is the situation, I got few threads started, in one is web server in another adc monitor, in third is remote logger. from time to time I got error:
MemoryError: memory allocation failed, allocating 1821 bytes
while trying to fix that i place some free heap monitoring and there is a lot of heap, but it still fails with memoty allocation error.
I also place gc_collect() in many places, it improves situation a bit, but it still fails with same error.
Increased _thead stack size, no effect.
How is the things working with threads, why fail to allocate memory since there is a lot? Is there a way to reserve some memory for a thread?
(sysname='esp32', nodename='esp32', release='1.10.0', version='v1.10-380-g6cf4e9675 on 2019-05-23', machine='ESP32 module with ESP32')
P.S.
problem was occured when I use this binary:
esp32-20190523-v1.10-380-g6cf4e9675.zip
Using it cause free heap in my case to vary between 77K to 30K and sometime fail with memory allocation error, decided to switch back to 1.10 and my device is working from few hours at maximum load without problem,. Free heap is stable around 70kb