summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology/include
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-09-28 16:41:20 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-09-28 16:41:20 +0000
commit69fa48ea8bf9fd9e49363ab405d3e55306be848b (patch)
treeffb76069fb3993fcce59d61117d03954f5c1e974 /src/Persistent_cohomology/include
parent468f9f1fcf5a818d1615b3102f6324f67a0a825c (diff)
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
Diffstat (limited to 'src/Persistent_cohomology/include')
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h11
1 files changed, 5 insertions, 6 deletions
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;
}
}