-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.14.2
-
None
-
Linux environment. Nvidia xavier board. QtCreator on Windows 10 as well
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;
}