Giter VIP home page Giter VIP logo

Comments (12)

donny681 avatar donny681 commented on June 7, 2024

When memory is exhausted,it output this debug.I think that it may be something wrong with library

Warn: Image draw cannot open the image resource (/home/fyy/esp/project/lv_port_esp32_ili9341/components/lvgl/lvgl/src/lv_draw/lv_img_cache.c #118)
Warn: Image draw error (/home/fyy/esp/project/lv_port_esp32_ili9341/components/lvgl/lvgl/src/lv_draw/lv_draw_img.c #61)
error 83: memory allocation failed

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

I found that if I create over two images objects,it will recall decoder_open function all the time,which reduce the memories.

from lv_port_esp32.

embeddedt avatar embeddedt commented on June 7, 2024

I can't see enough of your code to know exactly what you're doing, but it sounds like you are creating new image objects over and over. You don't need to do that. Just change the source of the existing image object(s).

Again, not much code to work with here, but I'm guessing that your UI has current and next weather images? That means you only need two image objects, and you can just change the sources of them as necessary. You don't need to create new ones each time you want a different image.

If, for some reason, you really need to create a new image object, remember that you should delete the first one with lv_obj_del. Otherwise it stays on the screen and keeps consuming memory.

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

@embeddedt Actually,I do need to create several images and change them day by day. Like you say,If I delete the images object,how can I change the source of picture.

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

I find the real reason,when I create two imge objects and a scrolled label ,there is a conflict between image and scrolled label,I post the code here (https://github.com/donny681/littlevgl_esp32).You can see that the it will reduce memories gradually if it creates two image object and a scrolled label.

from lv_port_esp32.

embeddedt avatar embeddedt commented on June 7, 2024

I do need to create several images and change them day by day.

As I mentioned, you can change the source of an image after it's created by calling lv_img_set_src again. There is no need to recreate/delete the image object.

Hmm. I don't see anywhere in your code that you are changing the image. You seem to just create it once in my_demo_create and then do nothing afterwards. Is my_demo_create ever called again after this line? Could you explain what parts of your code are relevant to the issue in more detail?

You can see that the it will reduce memories gradually if it creates two image object and a scrolled label.

I very much doubt this is the cause. It's more likely that the label just speeds up the exhaustion of heap space because it uses some memory to store the text.

Please check that you are not recreating objects multiple times. LittlevGL does not work like some other libraries where you have to call a "drawText" API or something similar in a loop. For LittlevGL creating an object once and then updating it later

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

No,I think that you misunderstand my meaning.As you mentioned.I do nothing after creating the UI.However,I don't know the reason why it contnued to reduces memories every second If I create two images and a scrolled label after doing nothing.There are five steps to prove the problems.

Firstly,just create two images then do nothing,the memonies are stable for a long time after a few seconds.

Secondly,If I create two images and a scrolled label .However,it resuces the memonies every second.After a few minutes all the memonies are exhausted because the scrolled label consumes the memonies every second.

Thirdly,if I just create only one images and a scrolled label,the memonies are still stable for a long time.

Forthly,if I just create a scrolled label,the memonies are still stable for a long time after a few seconds.

Finally,If I create several images and the memonies are still stable for a long time after a few seconds.

Therefore,it is not a matter of how many images you create.I just want to know why memonies are used out finally when creating some images and a scrolled label.

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 7, 2024

@donny681

I was able to reproduce the issue and found the problem. lodepng loads the PNG file into buffer, and this buffer wasn't freed.

I've fixed it here: lvgl/lv_lib_png@5018378

I hope it solves your issue.

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

@kisvegabor it works.Thank you.

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

@kisvegabor However,when I try to change the text of other static label.It will affect the original scrolled label .For example,if I create two images ,a scrolled label and a static label.If I want to change the text of the static label.Actually it change the text of scrolled label.

If I just create two images and a static label.It is ok to change the text of static label.

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 7, 2024

Please send a code snippet?
Do you see the issue without the images too?

from lv_port_esp32.

donny681 avatar donny681 commented on June 7, 2024

Sorry,It is my fault .I do something wrong with it personally.

from lv_port_esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.