summaryrefslogtreecommitdiffstats
path: root/include/framework
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2023-10-31 11:51:46 -0400
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2023-10-31 11:51:46 -0400
commit1b8bec5ea882584aba62c92d1ab6ffaf03e7b9b5 (patch)
tree6c6296555cb37be53bc3b17b3b36b017e880acdf /include/framework
parent62792753bb4df2515e5e2d8cc48bca568c5379fd (diff)
downloaddynamic-extension-1b8bec5ea882584aba62c92d1ab6ffaf03e7b9b5.tar.gz
DynamicExtension: fixed some Epoch-related bugs
The epochs must be released in the destructor prior to releasing the buffers and structures, as otherwise there are references remaining to these objects and their destructors will fail. Additionally, fixed a bug in the constructor resulting in a memory leak due to allocating an extra starting version and buffer.
Diffstat (limited to 'include/framework')
-rw-r--r--include/framework/DynamicExtension.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h
index 2f0327f..a1f7c2b 100644
--- a/include/framework/DynamicExtension.h
+++ b/include/framework/DynamicExtension.h
@@ -55,12 +55,16 @@ public:
auto vers = new Structure(m_buffer_capacity, m_scale_factor, m_max_delete_prop);
auto epoch = new _Epoch(vers, buf);
- m_buffers.insert(new Buffer(buffer_cap, max_delete_prop*buffer_cap));
- m_versions.insert(new Structure(buffer_cap, scale_factor, max_delete_prop));
+ m_buffers.insert(buf);
+ m_versions.insert(vers);
m_epochs.insert({0, epoch});
}
~DynamicExtension() {
+ for (auto e : m_epochs) {
+ delete e.second;
+ }
+
for (auto e : m_buffers) {
delete e;
}
@@ -68,10 +72,6 @@ public:
for (auto e : m_versions) {
delete e;
}
-
- for (auto e : m_epochs) {
- delete e.second;
- }
}
int insert(const R &rec) {