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. Utilizing all Desktop memory for QImage objects
Qt 6.11 is out! See what's new in the release blog

Utilizing all Desktop memory for QImage objects

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.7k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I'm running the following test and only get down to the third image before the images become zero. I get no errors or warnings. I still have plenty of memory left on my box. My Win7-64 bit box has 6GB. When I start my test it starts with 2.22 GB used and peaks around 3.10 GB. My Test Image is around 225 MB. Any Suggestion?

    Thanks

    Results:
    img1 size = QSize(5819, 20543)
    img2 size = QSize(5819, 20543)
    img3 size = QSize(0, 0)
    img4 size = QSize(0, 0)
    img5 size = QSize(0, 0)
    img6 size = QSize(0, 0)
    img7 size = QSize(0, 0)

    @
    void MainWindow::on_pushButton_clicked()
    {
    QScopedPointer<QImage> img1(new QImage("test.png"));
    qDebug()<<"img1 size = "<<img1->size();
    QScopedPointer<QImage> img2(new QImage("test.png"));
    qDebug()<<"img2 size = "<<img2->size();
    QScopedPointer<QImage> img3(new QImage("test.png"));
    qDebug()<<"img3 size = "<<img3->size();
    QScopedPointer<QImage> img4(new QImage("test.png"));
    qDebug()<<"img4 size = "<<img4->size();
    QScopedPointer<QImage> img5(new QImage("test.png"));
    qDebug()<<"img5 size = "<<img5->size();
    QScopedPointer<QImage> img6(new QImage("test.png"));
    qDebug()<<"img6 size = "<<img6->size();
    QScopedPointer<QImage> img7(new QImage("test.png"));
    qDebug()<<"img7 size = "<<img7->size();
    }
    @

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Is your executable(not the OS) 32 or 64 bit? Processes have limits on available address space.
      Here's a detailed table: "Windows memory limits":http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778.aspx#memory_limits

      It doesn't matter how much RAM you physically have. Pages of memory can be stored on hard drive if your machine runs out of physical RAM.
      More important are the address space limits. In 64bit app you could theoretically allocate up to 8TB. For a 32 bit process this is about 2GB (up to 4GB with some hackery) even on 64bit Windows.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        It's irrelevant what space the compressed PNG file occupies on disc: it must be uncompressed in memory in order to support drawing on a per-pixel basis. Assuming 32 bits are allocated for each pixel in your colour image then, at the very least, your 5819x20543 image occupies 478 million bytes. You don't get many of these in RAM before you bang up against the 2GB 32-bit process limit in Windows.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Thank you for your responses. It now make sense what is happening. I'm using mingw as the compiler and I see that mingw has a 64 bit compiler for Windows. Unless I overlooked something, I don't see that Qt has a 64 bit set up for Windows. What is the easiest way to create a 64bit Qt development environment?

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

            Hi,

            You have to either build Qt using mingw-64 or build Qt using visual studio's 64 bit console. And then point QtCreator to that new version and use it.

            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