Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24709

CRASH: QPixmap/QImage contains memory leak which leads to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.3
    • 4.8.0
    • Image formats
    • None
    • 3b7edefb5b8a3dd6b1b53af4039cf1a862cd0aed

    Description

      Code to reproduce:

          for(;;)
          {
              qDebug() << "allocating....";
              QPixmap testPixmap (10000,10000);
              QImage testImage2(10000,10000, QImage::Format_RGB32);
              testPixmap.convertFromImage( testImage2 );
          }
      

      Remark: In contrast to https://bugreports.qt-project.org/browse/QTBUG-24710 this is not forcing a memory leak. The memory leak is already there...

      This one should never crash because it only allocates memory within the loop. Releasing it after leaving the block. On my Mac it crashes after 4 allocations.

      The final crash is related to another bug. In this ticket I am concerned about the memory leak which consumes more and more memory in the loop.

          allocating.... 
          allocating.... 
          allocating.... 
          allocating.... 
          TexturePacker(59326,0xac3dc2c0) malloc: *** mmap(size=400003072) failed (error code=12)
          *** error: can't allocate region
          *** set a breakpoint in malloc_error_break to debug
      

      Result

          0   libsystem_c.dylib             	0x936d1a57 memmove$VARIANT$sse42 + 154
          1   QtGui                         	0x034223ab QMacPixmapData::resize(int, int) + 211
          2   QtGui                         	0x034227a5 QMacPixmapData::fromImage(QImage const&, QFlags<Qt::ImageConversionFlag>) + 1003
          3   QtGui                         	0x0340f00e QPixmap::convertFromImage(QImage const&, QFlags<Qt::ImageConversionFlag>) + 62
          4   de.code-and-web.TexturePacker 	0x000ade0d guiMode(int, char**) + 845 (main.cpp:518)
          5   de.code-and-web.TexturePacker 	0x000b9962 main + 226 (main.cpp:1132)
          6   de.code-and-web.TexturePacker 	0x0003ce25 start + 53
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andysh Andy Shaw
            andreasloew Andreas Loew
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes