memtable: fix memory leak

Since memtable::partitions is now an intrusive_set, it must be cleared
explicitly, or memory is leaked.
This commit is contained in:
Avi Kivity
2015-07-26 20:01:50 +03:00
parent 261df2c40f
commit 182d5ab798
2 changed files with 5 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ memtable::memtable(schema_ptr schema)
, partitions(partition_entry::compare(_schema)) {
}
memtable::~memtable() {
partitions.clear_and_dispose(std::default_delete<partition_entry>());
}
memtable::const_mutation_partition_ptr
memtable::find_partition(const dht::decorated_key& key) const {
auto i = partitions.find(key, partition_entry::compare(_schema));

View File

@@ -76,6 +76,7 @@ public:
using const_mutation_partition_ptr = std::unique_ptr<const mutation_partition>;
public:
explicit memtable(schema_ptr schema);
~memtable();
schema_ptr schema() const { return _schema; }
mutation_partition& find_or_create_partition(const dht::decorated_key& key);
mutation_partition& find_or_create_partition_slow(partition_key_view key);