mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 13:06:57 +00:00
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:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user