← index #4518PR #7298
Related · medium · value 6.473
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 · PULL REQUEST

esp32/machine_rtc: Preserve RTC user memory over most reset causes.

mergedby karfasopened 2021-05-22updated 2023-12-06
port-esp32

ESP32: New compile-time #define allowing to preserve the RTC slow memory during most resets.

Usage:

#define MICROPY_HW_RTC_USER_MEM_NOINIT

e.g. in port/esp32/board/XXX/mpconfigboard.h

When above is defined, the user memory area - accessible by machine.RTC.memory() will survive most reboot causes. A power-on reset (also caused by the EN pin on some boards) will clean the memory. When this happens, the magic number not found in the user memory will cause initialization.

After other resets (triggered by watchdogs, machine.reset(), ...), the user is responsible to check and validate the contents of the user area.

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