← index #16144Issue #15673
Likely Duplicate · high · value 4.258
QUERY · ISSUE

Wrong message on malloc fail

openby Tangerinoopened 2024-11-03updated 2026-03-24
bugport-esp32needs-info

Port, board and/or hardware

esp32

MicroPython version

MemoryError: memory allocation failed, allocating %u bytes
MicroPython v1.24.0 on 2024-10-25; Generic ESP32 module with ESP32

Reproduction

Allocated a big list

Expected behaviour

Fail with the right message

Observed behaviour

MemoryError: memory allocation failed, allocating %u bytes
MicroPython v1.24.0 on 2024-10-25; Generic ESP32 module with ESP32

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Wrong size reported while the memory allocation failed.

closedby xllaopened 2024-08-17updated 2024-08-25
bug

Port, board and/or hardware

esp32

MicroPython version

MicroPython v1.20.0-729-g82bf0aa19-dirty on 2024-08-17; M5Coreink with ESP32-PICO-D4

Reproduction

while execute lv display driver create function
self.disp_drv = lv.display_create(self.width, self.height)

width and height is same , equal to 200.

Expected behaviour

expected to print correct allocating bytes.

Observed behaviour

MemoryError: memory allocation failed, allocating 1073659464 bytes

Additional Information

As I search the error message inside repo, I found the exception was throw from m_malloc_fail function, at there, size_t variable was cast to uint, maybe uint is smaller than size_t, so it is overflow.
can we use %zu for size_t instead of cast to uint?

Code of Conduct

Yes, I agree

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