<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><span style="color: rgb(68, 68, 68); font-family: Calibri; line-height: 22.7199993133545px; background-color: rgb(255, 255, 255);">I think the memory leak issue origined from QuadEdgeMesh,</span><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><div style="line-height: 22.7199993133545px;">#include "itkQuadEdgeMesh.h"</div><div style="line-height: 22.7199993133545px;">#include "itkRegularSphereMeshSource.h"</div><div style="line-height: 22.7199993133545px;"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px;"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px;">typedef itk::QuadEdgeMesh< double, 3 > TMesh;</div><div style="line-height: 22.7199993133545px;">typedef itk::RegularSphereMeshSource< TMesh > TSource;</div><div style="line-height: 22.7199993133545px;"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px;">int main(int argc, char ** argv)</div><div style="line-height: 22.7199993133545px;">{</div><div style="line-height: 22.7199993133545px;">  TSource::Pointer source = TSource::New();</div><div style="line-height: 22.7199993133545px;">  source->Update();</div><div style="line-height: 22.7199993133545px;">  TSource::Pointer source1 = TSource::New();</div><div style="line-height: 22.7199993133545px;">  source1->SetResolution(5);</div><div style="line-height: 22.7199993133545px;">  source1->Update();</div><div style="line-height: 22.7199993133545px;">  TMesh::Pointer mesh = source->GetOutput();</div><div style="line-height: 22.7199993133545px;">  mesh->Graft( source1->GetOutput());</div><div style="line-height: 22.7199993133545px;"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px;">  return EXIT_SUCCESS;</div><div style="line-height: 22.7199993133545px;"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px;">}</div></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);">It gives memory leak errors as well. </div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);"><br style="line-height: 22.7199993133545px;"></div><div style="line-height: 22.7199993133545px; color: rgb(68, 68, 68); font-family: Calibri; background-color: rgb(255, 255, 255);">wanlin</div><br><div>> Date: Wed, 3 Jun 2015 09:49:33 -0700<br>> From: davis.vigneault@gmail.com<br>> To: insight-users@itk.org<br>> Subject: [ITK-users] Possible memory leak in itk::IterativeTriangleCellSubdivisionQuadEdgeMeshFilter<br>> <br>> All--<br>> <br>> I've been observing some erratic behavior in my program, which after some<br>> investigation I believe may be due to a memory leak in<br>> itk::IterativeTriangleCellSubdivisionQuadEdgeMeshFilter.  I've copied below<br>> a minimal example which exhibits the problem, along with the output from<br>> valgrind showing 15,360 bytes lost in 128 blocks.  Is anyone able to<br>> reproduce this issue?  (Note that the 72,704 bytes still reachable is <br>> valgrind's fault<br>> <http://stackoverflow.com/questions/30376601/valgrind-memory-still-reachable-with-trivial-program-using-iostream> <br>> , not ITK's).<br>> <br>> ///////////////////////////////////////<br>> // MINIMAL EXAMPLE //<br>> ///////////////////////////////////////<br>> <br>> #include "itkQuadEdgeMesh.h"<br>> #include "itkRegularSphereMeshSource.h"<br>> #include "itkLoopTriangleCellSubdivisionQuadEdgeMeshFilter.h"<br>> #include "itkIterativeTriangleCellSubdivisionQuadEdgeMeshFilter.h"<br>> <br>> typedef itk::QuadEdgeMesh< double, 3 > TMesh;<br>> typedef itk::RegularSphereMeshSource< TMesh > TSource;<br>> typedef itk::LoopTriangleCellSubdivisionQuadEdgeMeshFilter< TMesh, TMesh ><br>> TLoop;<br>> typedef itk::IterativeTriangleCellSubdivisionQuadEdgeMeshFilter< TMesh,<br>> TLoop > TSubdivide;<br>> <br>> int main(int argc, char ** argv)<br>> {<br>> <br>>   TSource::Pointer source = TSource::New();<br>>   TSubdivide::Pointer sub = TSubdivide::New();<br>>   sub->SetInput( source->GetOutput() );<br>>   sub->SetResolutionLevels( 1 );<br>>   sub->Update();<br>> <br>>   return EXIT_SUCCESS;<br>> <br>> }<br>> <br>> ////////////////////////////////////////<br>> // VALGRIND OUTPUT //<br>> ////////////////////////////////////////<br>> <br>> $ valgrind --leak-check=full ./dv-registration<br>> ==20328== Memcheck, a memory error detector<br>> ==20328== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.<br>> ==20328== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info<br>> ==20328== Command: ./dv-registration<br>> ==20328== <br>> ==20328== <br>> ==20328== HEAP SUMMARY:<br>> ==20328==     in use at exit: 92,160 bytes in 257 blocks<br>> ==20328==   total heap usage: 13,030 allocs, 12,773 frees, 879,010 bytes<br>> allocated<br>> ==20328== <br>> ==20328== 19,456 (15,360 direct, 4,096 indirect) bytes in 128 blocks are<br>> definitely lost in loss record 2 of 3<br>> ==20328==    at 0x4C2B0A5: operator new(unsigned long)<br>> (vg_replace_malloc.c:324)<br>> ==20328==    by 0x4984F8: itk::QuadEdgeMesh<double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float><br>> >::AddFace(itk::GeometricalQuadEdge<unsigned long, unsigned long, bool,<br>> bool, true>*) (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x49926F: itk::QuadEdgeMesh<double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float><br>> >::AddFaceWithSecurePointList(std::vector<unsigned long,<br>> std::allocator<unsigned long> > const&, bool) (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x49D0D5: void<br>> itk::CopyMeshToMeshCells<itk::QuadEdgeMesh&lt;double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> >,<br>> itk::QuadEdgeMesh<double, 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool,<br>> bool, float, float> > >(itk::QuadEdgeMesh<double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> > const*,<br>> itk::QuadEdgeMesh<double, 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool,<br>> bool, float, float> >*) (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x491766:<br>> itk::QuadEdgeMeshToQuadEdgeMeshFilter<itk::QuadEdgeMesh&lt;double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> >,<br>> itk::QuadEdgeMesh<double, 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool,<br>> bool, float, float> > >::CopyInputMeshToOutputMeshCells() (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x4916E2:<br>> itk::QuadEdgeMeshToQuadEdgeMeshFilter<itk::QuadEdgeMesh&lt;double, 3u,<br>> itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> >,<br>> itk::QuadEdgeMesh<double, 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool,<br>> bool, float, float> > >::CopyInputMeshToOutputMeshGeometry() (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x491063:<br>> itk::IterativeTriangleCellSubdivisionQuadEdgeMeshFilter<itk::QuadEdgeMesh&lt;double,<br>> 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> >,<br>> itk::LoopTriangleCellSubdivisionQuadEdgeMeshFilter<itk::QuadEdgeMesh&lt;double,<br>> 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool, bool, float, float> >,<br>> itk::QuadEdgeMesh<double, 3u, itk::QuadEdgeMeshTraits&lt;double, 3u, bool,<br>> bool, float, float> > > >::GenerateData() (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x4C578C:<br>> itk::ProcessObject::UpdateOutputData(itk::DataObject*) (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328==    by 0x4866C6: main (in<br>> /home/davis/Developer/oxford/Stebbing_Method/SubTest/bin/dv-registration)<br>> ==20328== <br>> ==20328== LEAK SUMMARY:<br>> ==20328==    definitely lost: 15,360 bytes in 128 blocks<br>> ==20328==    indirectly lost: 4,096 bytes in 128 blocks<br>> ==20328==      possibly lost: 0 bytes in 0 blocks<br>> ==20328==    still reachable: 72,704 bytes in 1 blocks<br>> ==20328==         suppressed: 0 bytes in 0 blocks<br>> ==20328== Reachable blocks (those to which a pointer was found) are not<br>> shown.<br>> ==20328== To see them, rerun with: --leak-check=full --show-leak-kinds=all<br>> ==20328== <br>> ==20328== For counts of detected and suppressed errors, rerun with: -v<br>> ==20328== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)<br>> <br>> <br>> <br>> <br>> --<br>> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Possible-memory-leak-in-itk-IterativeTriangleCellSubdivisionQuadEdgeMeshFilter-tp7587434.html<br>> Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>> _____________________________________<br>> Powered by www.kitware.com<br>> <br>> Visit other Kitware open-source projects at<br>> http://www.kitware.com/opensource/opensource.html<br>> <br>> Kitware offers ITK Training Courses, for more information visit:<br>> http://www.kitware.com/products/protraining.php<br>> <br>> Please keep messages on-topic and check the ITK FAQ at:<br>> http://www.itk.org/Wiki/ITK_FAQ<br>> <br>> Follow this link to subscribe/unsubscribe:<br>> http://public.kitware.com/mailman/listinfo/insight-users<br></div>                                       </div></body>
</html>