carve icon indicating copy to clipboard operation
carve copied to clipboard

Memory leak in intersect.cpp 1377 and 1378 from a_rtree and b_rtree

Open GoogleCodeExporter opened this issue 10 years ago • 2 comments

The current version (e82d852e4fb0) has a memory leak in intersect.cpp (1377) 
and 1378 from a_rtree and b_rtree.  Deleting them fixes it as expected (shown 
below).

carve::mesh::MeshSet<3> *carve::csg::CSG::compute(carve::mesh::MeshSet<3> *a,
...

  delete a_rtree;
  delete b_rtree;

  return result;
}

Other than this carve works really well, thank you for creating it!

Original issue reported on code.google.com by [email protected] on 6 Mar 2014 at 3:58

GoogleCodeExporter avatar Dec 12 '15 18:12 GoogleCodeExporter

The variables a_rtree and b_rtree are managed by std::auto_ptr, so the object 
is deleted by aut_ptr.
std::auto_ptr<face_rtree_t> a_rtree(...)

Even "delete a_rtree;" should not be accepted by your compiler...

Original comment by [email protected] on 18 Mar 2014 at 12:34

GoogleCodeExporter avatar Dec 12 '15 18:12 GoogleCodeExporter

Sorry, I had multiple versions of the source and got them mixed up.  The memory 
leak was fixed by using auto_ptr instead of a raw pointer in c070b0388d6a.  
I'll verify that I have the correct version next time.

Original comment by [email protected] on 18 Mar 2014 at 3:56

GoogleCodeExporter avatar Dec 12 '15 18:12 GoogleCodeExporter