[vtk-developers] vtkLoopSubdivisionFilter
Laurent Chauvin
lchauvin at bwh.harvard.edu
Mon Jul 18 14:20:49 EDT 2011
Hello,
I was using vtkLoopSubdivisionFilter, but after leaving Slicer I got hundred
of thousands of vtkIdList leaks.
After debugging, the problem seems to come from this part of code:
void vtkLoopSubdivisionFilter::GenerateEvenStencil (vtkIdType p1,
vtkPolyData *polys,
vtkIdList *stencilIds,
double *weights)
{
vtkIdList *cellIds = vtkIdList::New();
vtkIdList *ptIds = vtkIdList::New();
vtkCell *cell;
int i, j;
int numCellsInLoop;
int startCell, nextCell;
vtkIdType p, p2;
vtkIdType bp1, bp2;
int K;
double beta, cosSQ;
// Get the cells that use this point
polys->GetPointCells (p1, cellIds);
numCellsInLoop = cellIds->GetNumberOfIds();
if (numCellsInLoop < 1)
{
vtkWarningMacro("numCellsInLoop < 1: " << numCellsInLoop);
stencilIds->Reset();
// Test Remove vtkIdList
cellIds->Delete();
ptIds->Delete();
// End Test
return;
}
// Find an edge to start with that contains p1
...
cellIds->Delete();
ptsIds->Delete();
}
If we return before the end of the function, the cellIds and ptsId are not
deleted (creating leaks).
I had the code between comments "Test Remove vtkIdList" and "End Test".
Leaks are gone.
I just would like to know if it was a mistake or if there is a reason for
not deleting before returning ?
Thank you.
-Laurent
--
Laurent Chauvin, MS
Surgical Planning Laboratory, Radiology
Brigham And Women's Hospital, Harvard Medical School
http://wiki.ncigt.org/index.php/User:Lchauvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20110718/2da30209/attachment.htm>
More information about the vtk-developers
mailing list