NDMeshStreamer: fixing a memory leak when using more than one
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Fri, 11 May 2012 19:28:29 +0000 (14:28 -0500)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Fri, 11 May 2012 19:28:29 +0000 (14:28 -0500)
phase of streaming with staged completion.

src/libs/ck-libs/NDMeshStreamer/NDMeshStreamer.h

index d70276e8a9770dba025e781d55d71301d9db5ac0..a47a3cb41522ea3e8a988188b93df579c8130f08 100644 (file)
@@ -7,7 +7,7 @@
 #include "completion.h"
 #include "ckarray.h"
 
-// limit total number of data items in system to
+// limit total number of buffered data items to
 // maxNumDataItemsBuffered_ (flush when limit is reached) but allow
 // allocation of up to a factor of OVERALLOCATION_FACTOR more space to
 // take advantage of nonuniform filling of buffers
@@ -320,6 +320,10 @@ MeshStreamer<dtype>::MeshStreamer(
   cntMsgExpected_ = new int[numDimensions_];
   cntFinished_ = new int[numDimensions_]; 
 
+  for (int i = 0; i < numDimensions_; i++) {
+    cntMsgSent_[i] = new int[individualDimensionSizes_[i]]; 
+  }
+
 #endif
 
 }
@@ -508,7 +512,6 @@ void MeshStreamer<dtype>::init(CkCallback startCb, CkCallback endCb,
                                int prio) {
 
   for (int i = 0; i < numDimensions_; i++) {
-    cntMsgSent_[i] = new int[individualDimensionSizes_[i]]; 
     std::fill(cntMsgSent_[i], 
               cntMsgSent_[i] + individualDimensionSizes_[i], 0);
     cntMsgReceived_[i] = 0;