Free rocksdb iterators

This commit is contained in:
Thomas Krijnen
2025-09-01 14:32:13 +02:00
parent 01b64674ab
commit a831884ee6
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -463,7 +463,7 @@ void IfcParse::impl::rocks_db_file_storage::process_deletion_inverse(IfcUtil::If
{
// compute next prefix that does not start with v|{id}|
auto prefix = "v|" + std::to_string(id) + "|";
auto it = db->NewIterator(rocksdb::ReadOptions());
auto it = std::unique_ptr<rocksdb::Iterator>(db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix);
while (it->Valid()) {
it->Next();
@@ -493,7 +493,7 @@ void IfcParse::impl::rocks_db_file_storage::process_deletion_inverse(IfcUtil::If
{
auto prefix = "v|" + std::to_string(name) + "|";
auto it = db->NewIterator(rocksdb::ReadOptions());
auto it = std::unique_ptr<rocksdb::Iterator>(db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix);
while (it->Valid() && it->key().starts_with(prefix)) {
std::string s = it->value().ToString();
+3 -3
View File
@@ -2324,7 +2324,7 @@ aggregate_of_instance::ptr IfcFile::instances_by_reference(int t) {
else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) {
// @todo no lower/upper_bounds() implemented yet
auto prefix = "v|" + std::to_string(t) + "|";
auto it = x.db->NewIterator(rocksdb::ReadOptions());
auto it = std::unique_ptr<rocksdb::Iterator>(x.db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix);
while (it->Valid() && it->key().starts_with(prefix)) {
std::vector<uint32_t> vals(it->value().size() / sizeof(uint32_t));
@@ -2477,7 +2477,7 @@ std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
} else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) {
// @todo no lower/upper_bounds() implemented yet
auto prefix = "v|" + std::to_string(instance_id) + "|";
auto it = x.db->NewIterator(rocksdb::ReadOptions());
auto it = std::unique_ptr<rocksdb::Iterator>(x.db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix);
while (it->Valid() && it->key().starts_with(prefix)) {
std::vector<uint32_t> vals(it->value().size() / sizeof(uint32_t));
@@ -2549,7 +2549,7 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
if (attribute_index == -1) {
// @todo no lower/upper_bounds() implemented yet
auto prefix = "v|" + std::to_string(instance_id) + "|" + std::to_string(ent->index_in_schema()) + "|";
auto it = x.db->NewIterator(rocksdb::ReadOptions());
auto it = std::unique_ptr<rocksdb::Iterator>(x.db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix);
while (it->Valid() && it->key().starts_with(prefix)) {
std::vector<uint32_t> vals(it->value().size() / sizeof(uint32_t));