[cig-commits] r15458 - in short/3D/PyLith/trunk: libsrc/meshio libsrc/topology pylith/perf
brad at geodynamics.org
brad at geodynamics.org
Fri Jul 10 17:22:41 PDT 2009
Author: brad
Date: 2009-07-10 17:22:40 -0700 (Fri, 10 Jul 2009)
New Revision: 15458
Modified:
short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
short/3D/PyLith/trunk/libsrc/topology/Field.cc
short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
Log:
Temporary fix for likely memory leak in section->clear().
Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-07-10 22:56:52 UTC (rev 15457)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-07-11 00:22:40 UTC (rev 15458)
@@ -117,8 +117,12 @@
assert(0 != _fieldAvg);
_fieldAvg->newSection(fieldIn, fiberDim);
_fieldAvg->allocate();
- } else if (_fieldAvg->chartSize() != cells->size()*fiberDim) {
+ } else if (_fieldAvg->sectionSize() != cells->size()*fiberDim) {
+#if 0 // :BUG: Avoid memory leak in section->clear()
_fieldAvg->clear();
+#else
+ delete _fieldAvg; _fieldAvg = new field_type(fieldIn.mesh());
+#endif
_fieldAvg->newSection(fieldIn, fiberDim);
_fieldAvg->allocate();
} // else
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-07-10 22:56:52 UTC (rev 15457)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-07-11 00:22:40 UTC (rev 15458)
@@ -284,12 +284,15 @@
{ // clear
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Field");
+
+ deallocate();
if (!_section.isNull())
_section->clear();
_scale = 1.0;
_vecFieldType = OTHER;
_dimensionsOkay = false;
+
logger.stagePop();
} // clear
@@ -301,11 +304,13 @@
{ // allocate
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Field");
+
assert(!_section.isNull());
const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
assert(!sieveMesh.isNull());
sieveMesh->allocate(_section);
+
logger.stagePop();
} // allocate
@@ -355,6 +360,7 @@
{ // complete
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Completion");
+
const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
assert(!sieveMesh.isNull());
@@ -362,6 +368,7 @@
ALE::Completion::completeSectionAdd(sieveMesh->getSendOverlap(),
sieveMesh->getRecvOverlap(),
_section, _section);
+
logger.stagePop();
} // complete
Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-07-10 22:56:52 UTC (rev 15457)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-07-11 00:22:40 UTC (rev 15458)
@@ -132,9 +132,10 @@
import pylith.perf.Field
if not stage in self.memory: self.memory[stage] = {}
- fieldModel = pylith.perf.Field.Field(field.label(), field.sectionSize(),
- field.chartSize())
- fieldModel.tabulate(self.memory[stage])
+ if not field is None:
+ fieldModel = pylith.perf.Field.Field(field.label(), field.sectionSize(),
+ field.chartSize())
+ fieldModel.tabulate(self.memory[stage])
return
More information about the CIG-COMMITS
mailing list