From 69fa48ea8bf9fd9e49363ab405d3e55306be848b Mon Sep 17 00:00:00 2001 From: glisse Date: Mon, 28 Sep 2015 16:41:20 +0000 Subject: Release CAM cells. There are a lot of intrusive containers in there, and I believe that most could be replaced with regular containers. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@800 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7246d7db0511ac6bffee2f645c006416a986629d --- .../include/gudhi/Persistent_cohomology.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index 05f70c39..efe20151 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -266,13 +266,10 @@ class Persistent_cohomology { } ~Persistent_cohomology() { -// Clean the remaining columns in the matrix. - for (auto & cam_ref : cam_) { - cam_ref.col_.clear(); - } -// Clean the transversal lists + // Clean the transversal lists for (auto & transverse_ref : transverse_idx_) { - transverse_ref.second.row_->clear(); + // Release all the cells + transverse_ref.second.row_->clear_and_dispose([&](Cell*p){cell_pool_.destroy(p);}); delete transverse_ref.second.row_; } } @@ -600,6 +597,8 @@ class Persistent_cohomology { Simplex_key key_tmp = dsets_.find_set(curr_col->class_key_); ds_repr_[key_tmp] = &(*(result_insert_cam.first)); result_insert_cam.first->class_key_ = key_tmp; + // intrusive containers don't own their elements, we have to release them manually + curr_col->col_.clear_and_dispose([&](Cell*p){cell_pool_.destroy(p);}); column_pool_.destroy(curr_col); // delete curr_col; } } -- cgit v1.2.3