ForeverDavid / carve

Automatically exported from code.google.com/p/carve
Other
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 ed.no.sp...@gmail.com on 6 Mar 2014 at 3:58

GoogleCodeExporter commented 9 years ago
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 fabian.g...@gmail.com on 18 Mar 2014 at 12:34

GoogleCodeExporter commented 9 years ago
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 ed.no.sp...@gmail.com on 18 Mar 2014 at 3:56