← index #4518Issue #4828
Related · high · value 6.516
QUERY · ISSUE

memory allocation error from time to time after machine.reset()

openby nedoskivopened 2019-02-18updated 2024-09-19
needs-info

Hello,
I'm using ESP32 with MicroPython v1.9.4-684-g51482ba92 without PSRAM

I got lot of stuff some _threads, while writing and changing I often restart the board, using machine.reset()

from time to time i got memory allocation error when my scripts start to load. So question is why, board reboot if some of them are too big it should fail every time. Not from time to time. Is there something that I'm missing?

CANDIDATE · ISSUE

THREADS: MemoryError: memory allocation failed

openby nedoskivopened 2019-06-02updated 2019-06-04
port-esp32

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

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied