TextArea image loading uses too much memory



  • Hello,

    I'm trying to work around this problem right now. I've been testing the app for a while and noticed that

    • TextArea element image loading consumes way too much memory, even if I have a NetworkDiskCache enabled with QMLNAMFactory in place.
    • The images resolutions are big (1920 width)
    • The images takes around 500-400kb per image as they are in the JPG format.

    This bring android system to be forced to kill the application midway thus causing problems to the user. I'm not sure whether it's the fact that it has too many image elements, or if the image resolution plays a big role into memory consumption.

    Any recommendations, suggestions are welcomed.


  • Lifetime Qt Champion

    Hi,

    How many image are you talking about ? Jpeg is a compressed format so the final result will be uncompressed to be shown on screen. Also, do you need to display all these images at full resolution ? If not then making thumbnails would be a good idea.



  • Hello,

    I'm working on a solution as we speak (there was also another bug that may have influenced the crash). As for generating thumbnails I could but... thing is that the textarea shows live information from different sources so modifying all that becomes tricky. Nonetheless I have no power over the live sources. At least from what I got the person used around 30-40 images. (no every image is 1920w).



  • Implemented the first fix which worked basically I was unnecessarily loading data I never intended to use.

    Regardless, once JPEG is uncompressed in memory the app can easily take 400-500mb. However, I'll probably end up pre-processing the images before it displays in the textarea (vs the normal size 70-80mb depending on what's loaded). The results are the same with 5.6.0, slightly more responsive I guess.

    I guess my next question would be how to prefetch those images to the network cache in Qt? Never done it before.


  • Lifetime Qt Champion

    I'd make my own image provide and do the caching there (or in a specialized class)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.