if there is memory leaks when draw pointcloud frequently?
Posted: Tue May 23, 2017 7:09 am
Hi:
I write a octree to draw huge amount of point cloud(almost 5 billion points) myself.
when i draw pointcloud,i find the memory is growing. for test is there memory leaks , I write some test code like following:
when i remove all children ,i find there is about 40M memory leak , but then i move mouse in window several times, the memory is free. Or I comment out "activeWin->redraw()" in code ,there is no memory leak.
I check ccpointcloud's function removeChild or clear(),it seems like no problem. I don't know why, but this is so weird to me,because i need add child、remove child and redraw glwindow frequently!
Is qglwindow->draw() has memory leaks somewhere?the code versions is 2.8.1.
I write a octree to draw huge amount of point cloud(almost 5 billion points) myself.
when i draw pointcloud,i find the memory is growing. for test is there memory leaks , I write some test code like following:
when i remove all children ,i find there is about 40M memory leak , but then i move mouse in window several times, the memory is free. Or I comment out "activeWin->redraw()" in code ,there is no memory leak.
I check ccpointcloud's function removeChild or clear(),it seems like no problem. I don't know why, but this is so weird to me,because i need add child、remove child and redraw glwindow frequently!
Is qglwindow->draw() has memory leaks somewhere?the code versions is 2.8.1.
Code: Select all
ccHObject* testDB = new ccHObject();
addToDB(testDB);
ccGLWindow* activeWin = getActiveGLWindow();
if (testDB)
{
// test 20 times
for (int i = 0; i<20; i++)
{
int nLen = 200000;
// new pointcloud
ccPointCloud* pcd = new ccPointCloud;
if (!pcd->reserveThePointsTable(nLen))
return;
CCVector3 point;
int offset(0);
// create points
for (int i = 0; i<nLen; i++)
{
point.x = qrand() % 2000;
point.y = qrand() % 2000;
point.z = qrand() % 2000;
pcd->addPoint(point);
}
pcd->setDisplay_recursive(activeWin);
testDB->addChild(pcd);
activeWin->redraw();
//activeWin->redraw();
}
}
// remove
testDB->removeAllChildren();
activeWin->redraw();