Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How much memory
QtWS25 Last Chance

How much memory

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.0k 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.
  • T Offline
    T Offline
    tclin1998
    wrote on last edited by
    #1

    Hi:
    QPixmap pmap;
    if pmap's size is 600 x 800; depth is 24;
    Does it take

    600 * 800 * (32/ 8 byte) / 1024 / 1024 = 1.83 Mega bytes ?

    Thanks!

    -Todd

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi Todd,

      I think so, yes.
      Afaik it's not compressed. What could be is that it uses 24 bit and not 32 per pixel, but i'm not sure about that.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        A pixmap is not compressed in memory (uncompressing them for each time they need to be drawn would be way too slow), so yes, it takes to full space to store everything you need, and possibly more for padding.

        Lesson to take home: don't try to allocate ridiculously large images (neither in a QPixmap, nor in a QImage, for that matter).

        1 Reply Last reply
        1
        • T Offline
          T Offline
          tclin1998
          wrote on last edited by
          #4

          Thanks Gerolf and Andre.
          One more questions about the QPixmap memoery.

          QPixmap mm(800, 600); // ~ 1.83M
          I then resize it using the Qt 4 recommendation method.
          mm = QPixmap(0,0);

          How about the old 1.83M memory. Does Qt recycle it for me or I need to do something
          to avoid memory leaks.

          Thanks
          -Todd

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Qt will release it at the appropriate time. When that is, could depend on the backend implementation for QPixmap that you are using. However: it is not something for you to worry about, normally.

            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