[MOAB-dev] r4444 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Jan 14 14:50:28 CST 2011


Author: kraftche
Date: 2011-01-14 14:50:28 -0600 (Fri, 14 Jan 2011)
New Revision: 4444

Modified:
   MOAB/trunk/src/TypeSequenceManager.cpp
   MOAB/trunk/src/VarLenDenseTag.cpp
   MOAB/trunk/src/VarLenSparseTag.cpp
Log:
fix bugs in get_memory_use (division by zero for variable-length tags with no values and possible infinite loop)

Modified: MOAB/trunk/src/TypeSequenceManager.cpp
===================================================================
--- MOAB/trunk/src/TypeSequenceManager.cpp	2011-01-14 20:06:12 UTC (rev 4443)
+++ MOAB/trunk/src/TypeSequenceManager.cpp	2011-01-14 20:50:28 UTC (rev 4444)
@@ -873,8 +873,8 @@
     SequenceData* data = (*i)->data();
     if (first < data->end_handle()) {
       append_memory_use( first, last, data, entity_storage, total_storage );
-      first  = data->end_handle() + 1;
     }
+    first  = data->end_handle() + 1;
   }
 }
 

Modified: MOAB/trunk/src/VarLenDenseTag.cpp
===================================================================
--- MOAB/trunk/src/VarLenDenseTag.cpp	2011-01-14 20:06:12 UTC (rev 4443)
+++ MOAB/trunk/src/VarLenDenseTag.cpp	2011-01-14 20:50:28 UTC (rev 4444)
@@ -617,7 +617,8 @@
   total *= sizeof(VarLenTag);
   total += per_entity + sizeof(*this) + TagInfo::get_memory_use();
   total += meshValue.mem() + sizeof(meshValue);
-  per_entity /= count;
+  if (count)
+    per_entity /= count;
   per_entity += sizeof(VarLenTag);
       
   return MB_SUCCESS;

Modified: MOAB/trunk/src/VarLenSparseTag.cpp
===================================================================
--- MOAB/trunk/src/VarLenSparseTag.cpp	2011-01-14 20:06:12 UTC (rev 4443)
+++ MOAB/trunk/src/VarLenSparseTag.cpp	2011-01-14 20:50:28 UTC (rev 4444)
@@ -429,7 +429,8 @@
   total = mData.size() * (3*sizeof(void*) + sizeof(VarLenTag));
   for (MapType::const_iterator i = mData.begin(); i != mData.end(); ++i)
     total += i->second.mem();
-  per_entity = total / mData.size();
+  if (mData.size())
+    per_entity = total / mData.size();
   total += sizeof(*this) + TagInfo::get_memory_use();
       
   return MB_SUCCESS;









More information about the moab-dev mailing list