[MOAB-dev] r2462 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Dec 4 09:25:04 CST 2008


Author: kraftche
Date: 2008-12-04 09:25:03 -0600 (Thu, 04 Dec 2008)
New Revision: 2462

Modified:
   MOAB/trunk/MBSkinner.cpp
Log:
fix big memory leak in skinner

Modified: MOAB/trunk/MBSkinner.cpp
===================================================================
--- MOAB/trunk/MBSkinner.cpp	2008-12-03 22:32:31 UTC (rev 2461)
+++ MOAB/trunk/MBSkinner.cpp	2008-12-04 15:25:03 UTC (rev 2462)
@@ -106,7 +106,20 @@
   }
 
   // remove the adjaceny tag
+  std::vector< std::vector<MBEntityHandle>* > adj_arr;
+  std::vector< std::vector<MBEntityHandle>* >::iterator i;
   if (0 != mAdjTag) {
+    for (MBEntityType t = MBVERTEX; t != MBMAXTYPE; ++t) {
+      MBRange entities;
+      result = thisMB->get_entities_by_type_and_tag( 0, t, &mAdjTag, 0, 1, entities );
+      assert(MB_SUCCESS == result);
+      adj_arr.resize( entities.size() );
+      result = thisMB->tag_get_data( mAdjTag, entities, &adj_arr[0] );
+      assert(MB_SUCCESS == result);
+      for (i = adj_arr.begin(); i != adj_arr.end(); ++i)
+        delete *i;
+    }
+  
     result = thisMB->tag_delete(mAdjTag);
     mAdjTag = 0;
     assert(MB_SUCCESS == result);




More information about the moab-dev mailing list