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

updatePaintNode() memory leak

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux environment. Nvidia xavier board. QtCreator on Windows 10 as well
    • Platform/s:
      Linux/X11, Windows

      Description

      I am drawing zones on a video. the zones change colors, and appear or disappear depending on system side information. This data for zone color and position is provided by a variable: m_zoneList

      When I run my application for an extended period, I see the Mem used % start to grow. The more often I draw the zones, the faster the Mem used % grows. I stripped down my updatePaintNode() so it paints from arbitrary values instead of system side variable. I can upload a QTCreator project that demonstrates the growing memory usage. 

      QSGNode *Zones::updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData *)
      {
       QSGNode *root = static_cast<QSGNode *>(oldNode);
       if(!root) {
           root = new QSGNode;
       }
      
      
       root->removeAllChildNodes();
       int sz = 100; //m_zoneList.size();
       QColor fgnd;
       QColor bgnd;
      
       if(sz > 0)
       {
           int i = 0;
           	QPointF xy1(371,338);
      	QPointF xy2(533,338);
      	QPointF xy3(564,540);
      	QPointF xy4(344,540);
           while(i < sz)	// paint the contrast zone (bgnd color) then the normla zone (fgnd color)
           {
              //i = 0;
              //QVariantList zList = m_zoneList.at(i).toList();
              fgnd.setNamedColor(m_color);        
      	xy1.setX(xy1.x()+10);
      	xy2.setX(xy2.x()+10);
      	xy3.setX(xy3.x()+10);
      	xy4.setX(xy4.x()+10);
              //QPointF points[4] = {xy1, xy2, xy3, xy4};
              
              QSGGeometry *geoZn = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4);
              geoZn->setLineWidth(3);
              geoZn->setDrawingMode(QSGGeometry::DrawLineLoop);
              geoZn->vertexDataAsPoint2D()[0].set(xy1.x(),xy1.y());
              geoZn->vertexDataAsPoint2D()[1].set(xy2.x(),xy2.y());
              geoZn->vertexDataAsPoint2D()[2].set(xy3.x(),xy3.y());
              geoZn->vertexDataAsPoint2D()[3].set(xy4.x(),xy4.y());
      	
              QSGFlatColorMaterial *z = new QSGFlatColorMaterial;
       	    z->setColor(fgnd);
      
              QSGGeometryNode *zone = new QSGGeometryNode; 	
              zone->setGeometry(geoZn); 
              zone->setMaterial(z);	 	
      	zone->setFlag(QSGNode::OwnsGeometry);
              zone->setFlag(QSGNode::OwnsMaterial);
              
              root->appendChildNode(zone);
      	
      	i++;
           }
       } 
      
      return root;
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            mcy Mercy Yuen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes