--- trunk/src/brains/BlockSnapshotManager.cpp 2013/06/16 15:15:42 1879 +++ trunk/src/brains/BlockSnapshotManager.cpp 2014/01/16 16:00:43 1964 @@ -76,6 +76,9 @@ namespace OpenMD { // number of frames in each block given the need to hold multiple blocks // in memory at the same time: nSnapshotPerBlock_ = int(frameCapacity) / blockCapacity_; + if (nSnapshotPerBlock_ <= 0) { + std::cerr << "not enough memory to hold two configs!" << std::endl; + } reader_ = new DumpReader(info, filename); nframes_ = reader_->getNFrames(); int nblocks = nframes_ / nSnapshotPerBlock_; @@ -175,6 +178,10 @@ namespace OpenMD { //in case, unloadBlock called multiple times activeRefCount_[i - activeBlocks_.begin()] = 0; } + + if (activeRefCount_[i-activeBlocks_.begin()] == 0) { + internalUnload(block); + } unloadSuccess = true; } else { @@ -198,6 +205,7 @@ namespace OpenMD { } void BlockSnapshotManager::internalUnload(int block) { + std::cerr << "called internal unload for block "<< block << "\n"; for (int i = blocks_[block].first; i < blocks_[block].second; ++i) { delete snapshots_[i]; snapshots_[i] = NULL;