From 40e24d12f581c2f20743e277fd18cd09a4cfc747 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 09:47:03 +0100 Subject: [PATCH 1/4] remove file mapping member in order to free file handles earlier --- keyvi/include/keyvi/dictionary/fsa/automata.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index 12feca7cd..dfe8afd48 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -91,20 +91,20 @@ class Automata final { explicit Automata(const dictionary_properties_t& dictionary_properties, loading_strategy_types loading_strategy, const bool load_value_store) : dictionary_properties_(dictionary_properties) { - file_mapping_ = boost::interprocess::file_mapping(dictionary_properties_->GetFileName().c_str(), - boost::interprocess::read_only); + boost::interprocess::file_mapping file_mapping = boost::interprocess::file_mapping( + dictionary_properties_->GetFileName().c_str(), boost::interprocess::read_only); const boost::interprocess::map_options_t map_options = internal::MemoryMapFlags::FSAGetMemoryMapOptions(loading_strategy); TRACE("labels start offset: %d", dictionary_properties_->GetPersistenceOffset()); - labels_region_ = boost::interprocess::mapped_region(file_mapping_, boost::interprocess::read_only, + labels_region_ = boost::interprocess::mapped_region(file_mapping, boost::interprocess::read_only, dictionary_properties_->GetPersistenceOffset(), dictionary_properties_->GetSparseArraySize(), 0, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( - file_mapping_, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), + file_mapping, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), dictionary_properties_->GetTransitionsSize(), 0, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy); @@ -117,7 +117,7 @@ class Automata final { if (load_value_store) { value_store_reader_.reset( - internal::ValueStoreFactory::MakeReader(dictionary_properties_->GetValueStoreType(), &file_mapping_, + internal::ValueStoreFactory::MakeReader(dictionary_properties_->GetValueStoreType(), &file_mapping, dictionary_properties_->GetValueStoreProperties(), loading_strategy)); } } @@ -415,7 +415,6 @@ class Automata final { private: dictionary_properties_t dictionary_properties_; std::unique_ptr value_store_reader_; - boost::interprocess::file_mapping file_mapping_; boost::interprocess::mapped_region labels_region_; boost::interprocess::mapped_region transitions_region_; unsigned char* labels_; From 9b05d2a1ead3ff24af01c47ea6d0c37fac29ff8f Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:26:19 +0100 Subject: [PATCH 2/4] fix clang tidy warning --- keyvi/include/keyvi/dictionary/fsa/automata.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index dfe8afd48..c17b540c8 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -98,13 +98,15 @@ class Automata final { internal::MemoryMapFlags::FSAGetMemoryMapOptions(loading_strategy); TRACE("labels start offset: %d", dictionary_properties_->GetPersistenceOffset()); - labels_region_ = boost::interprocess::mapped_region(file_mapping, boost::interprocess::read_only, - dictionary_properties_->GetPersistenceOffset(), - dictionary_properties_->GetSparseArraySize(), 0, map_options); + labels_region_ = boost::interprocess::mapped_region( + file_mapping, boost::interprocess::read_only, + static_cast(dictionary_properties_->GetPersistenceOffset()), + dictionary_properties_->GetSparseArraySize(), 0, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( - file_mapping, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), + file_mapping, boost::interprocess::read_only, + static_cast(dictionary_properties_->GetTransitionsOffset()), dictionary_properties_->GetTransitionsSize(), 0, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy); From 16fe92af16f8fc281a78c3cb6f0c3f620d966616 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:35:53 +0100 Subject: [PATCH 3/4] ignore private headers from boost in clang-tidy --- keyvi/.clang-tidy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keyvi/.clang-tidy b/keyvi/.clang-tidy index 994895618..68688bdf2 100644 --- a/keyvi/.clang-tidy +++ b/keyvi/.clang-tidy @@ -16,3 +16,11 @@ Checks: "*, " HeaderFilterRegex: '' FormatStyle: none +CheckOptions: + - key: misc-include-cleaner.IgnoreHeaders + # The following files are ignored when clang-tidy analyzes header + # inclusions: + # - boost detail + value: ' + boost/.*/detail/.*\.hpp; + ' From f29f8b87b8785cf4c57c135408456a7cabbe4ac9 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:36:08 +0100 Subject: [PATCH 4/4] fix nullptr --- keyvi/include/keyvi/dictionary/fsa/automata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index c17b540c8..e85a7df76 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -101,13 +101,13 @@ class Automata final { labels_region_ = boost::interprocess::mapped_region( file_mapping, boost::interprocess::read_only, static_cast(dictionary_properties_->GetPersistenceOffset()), - dictionary_properties_->GetSparseArraySize(), 0, map_options); + dictionary_properties_->GetSparseArraySize(), nullptr, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( file_mapping, boost::interprocess::read_only, static_cast(dictionary_properties_->GetTransitionsOffset()), - dictionary_properties_->GetTransitionsSize(), 0, map_options); + dictionary_properties_->GetTransitionsSize(), nullptr, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy);