<br><div class="gmail_quote">On Mon, Jul 18, 2011 at 2:20 PM, Laurent Chauvin <span dir="ltr"><<a href="mailto:lchauvin@bwh.harvard.edu">lchauvin@bwh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br><br>I was using vtkLoopSubdivisionFilter, but after leaving Slicer I got hundred of thousands of vtkIdList leaks.<br><br>After debugging, the problem seems to come from this part of code:<br><br>void vtkLoopSubdivisionFilter::GenerateEvenStencil (vtkIdType p1,<br>
vtkPolyData *polys,<br> vtkIdList *stencilIds,<br> double *weights)<br>
{<br> vtkIdList *cellIds = vtkIdList::New();<br> vtkIdList *ptIds = vtkIdList::New();<br> vtkCell *cell;<br><br> int i, j;<br> int numCellsInLoop;<br> int startCell, nextCell;<br> vtkIdType p, p2;<br> vtkIdType bp1, bp2;<br>
int K;<br> double beta, cosSQ;<br><br> // Get the cells that use this point<br> polys->GetPointCells (p1, cellIds);<br> numCellsInLoop = cellIds->GetNumberOfIds();<br> if (numCellsInLoop < 1)<br> {<br>
vtkWarningMacro("numCellsInLoop < 1: " << numCellsInLoop);<br> stencilIds->Reset();<br><br> // Test Remove vtkIdList<br> cellIds->Delete();<br> ptIds->Delete();<br> // End Test<br>
<br> return;<br> }<br> // Find an edge to start with that contains p1<br><br>...<br>cellIds->Delete();<br>ptsIds->Delete();<br>}<br><br>If we return before the end of the function, the cellIds and ptsId are not deleted (creating leaks).<br>
I had the code between comments "Test Remove vtkIdList" and "End Test".<br><br>Leaks are gone.<br><br>I just would like to know if it was a mistake or if there is a reason for not deleting before returning ?<br>
<br>Thank you.<br>-Laurent<br clear="all"><font color="#888888"><br>-- <br><div>Laurent Chauvin, MS</div></font></blockquote><div><br></div>Seems like an oversight. I've seen that same type of thing in one or two cases before. That seems to be the right fix to me.<br clear="all">
<br><div>David </div></div>