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

QDeclarativeEffect::setTextureImage(const QImage& value) leaks memory a lot

    XMLWordPrintable

Details

    • 407fbda1f83f9b18572427306fbb430702dc20ff c7e1828b7352c4d86f98b5a032fa840988251c19

    Description

      I am texturing an Item3D in QML with the textureImage property with a QImage which is set from C++ via the rootContext of the QDeclarativeComponent. The QImage texture is a rendering of a QGraphicsScene which is being updated. We want to update the Item3D texturing after each QGraphicsScene update - meaning a new QImage is rendered for each QGraphicsScene::changed ( const QList<QRectF> & region ) signal. The resulting QImage is updated in QML from C++ after each update.

      This scenario leaks memory exponentially. After a minute or so, the test application is using 1.5GB of memory.

      If the QImage is not updated as a texture (but the painting happening in any case), the memory consuption for the QML below is at steady ~20kB.

      The QML that is being textured is as follows.

       import Qt 4.7
       import Qt3D 1.0
       import Qt3D.Shapes 1.0
      
       Viewport {
           width: 490; height: 720
           property Image textureImage
      
           Cube {
               scale: 2.0;
               id: theCube
               transform: Rotation3D {
                   angle: 30; axis: Qt.vector3d(1, 1, 1)
               }
      
               effect: Effect {
                   id: textureEffect
                   textureImage: textureBitmapImage
                   decal: true
               }
           }
       }
      

      The QImage texture is updated to QML like so:

      void QmlApplicationViewer::onTextureUpdated(QImage updatedTexture) {
          QVariant variantImage = updatedTexture;
          m_d->m_rootContext->setContextProperty("textureBitmapImage", variantImage);
      }
      

      Qt 3D is compiled from Git repository https://qt.gitorious.org/qt-labs/qt3d

      I can provide complete source code privately on request.

      Attachments

        Issue Links

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

          Activity

            People

              debhal Julian de Bhal (closed Nokia identity) (Inactive)
              kypeli Johan Paul
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes