Open simonchen007 opened 4 years ago
You probably have to increase LV_MEM_SIZE
(or the size of whatever heap you use).
I change it as (64U 1024U),still the same. however, I change it as 128U 1024U , I would goes to compile error.
lodepng uses normal malloc
. So you are simply out of heap on ESP.
so, are you meaning the problem is because the esp32 having not enough money ? I tested over 50 times last night, if the PNG is over 5kb, I would get this error. however, if I use the normal way(make the png as c-array first), and do not use lodepng, 100kb png file is also works.
so, are you meaning the problem is because the esp32 having not enough money ?
I don't know how much money ESP has but it might be out of memory. :slightly_smiling_face: :
The resolution of the PNG matters. During decoding the PNG image a hor. res x ver.res. x color size
array is allocated into RAM. E.g. for 200 px x 200 px x 2 bytes = ~80kB
esp32 having 320K memory. And I read the code of lodepng, "memory allocation failed" is because case 83 . if esp32 out of memory, I would not send any error, it would just go reboot.
What is the resolution of the image?
320*480
It means the decompressed image is 3202402 = 300kB. If it uses 32-bit color format internally (I'm not sure now) than its 600 kB. Anyway, 320kB is not enough in either case.
but why if I use the normal way(make the png as c-array first), and do not use lodepng, even 100kb png file is works ?
The PNG doesn't need to be decoded into RAM first with that method. It can be drawn directly from flash to the display.
I also encountered the problem under lvgl 8.3. But I found two ways to solve it
#LV_MEM_CUSTOM 1
use the malloc
and free
realloc
waiting for the real solution đŸ˜„
You can increase LV_MEM_SIZE
to add more memory for LVGL.
Yes I tried, but it still reports an error。 So I personally think it's possible that lvgl's heap management may not be able to allocate large chunks of memory due to memory fragmentation in some cases
@kisvegabor
apologize to you. it's my mistake.
I just committed git and found that the changelog had a change that I had debugged.
It affected the lvgl
allocation
hello,
I'm using esp32 + lvgl + lv_lib_lodepng, but when I use a png more 20K , it would shows "memory allocation failed", where can I change for making the memory allocation bigger ?