Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. TextArea image loading uses too much memory
QtWS25 Last Chance

TextArea image loading uses too much memory

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • David.GD Offline
    David.GD Offline
    David.G
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • David.GD Offline
        David.GD Offline
        David.G
        wrote on last edited by
        #3

        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).

        1 Reply Last reply
        0
        • David.GD Offline
          David.GD Offline
          David.G
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved