Hi!
It seems on ESP32 port the lodepng library is still not using the custom (MicroPython) memory allocation function from mp_lodepng.c
file, instead it uses the old malloc()
, and that throws a memory allocation error.
Although the LODEPNG_NO_COMPILE_ALLOCATORS
is defined in lv_bindings/mkrules.cmake
file, the compiled lodepng.cpp
file is still using malloc()
.
Could you please check it on your M5Core2 device (or other device)?
Thank you!
Repro steps:
-
Add following line to
lv_bindings/driver/png/lodepng/lodepng.cpp
file line#78
(insidelodepng_malloc()
function):
printf("* LODEPNG-OLD-malloc *");
-
Add following line to
lv_bindings/driver/png/mp_lodepng.c
file line line#11
(insidelodepng_malloc()
function):
printf("* LODEPNG-NEW-malloc *");
-
Download attached test app (see below:
png-test.zip
) to your Linux dev environment -
Edit, then run
run-linux-simulator.sh
script
Result:LODEPNG-NEW-malloc
text is shown in console, and PNG image is shown inTFT Simulator
window -
Edit, then run
run-m5core2.sh
script
Result:LODEPNG-OLD-malloc
text is shown, no image on device, and there is also an error message:lodepng_error: memory allocation failed
png-test.zip (11.7 KB)