Skip to content

Commit

Permalink
[Fix](inverted index) fix memory leak when inverted index writer not …
Browse files Browse the repository at this point in the history
…close (#33724) (#34374)

Co-authored-by: airborne12 <[email protected]>
  • Loading branch information
xiaokang and airborne12 authored May 1, 2024
1 parent 74ed6e8 commit d0e89c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ class InvertedIndexColumnWriterImpl : public InvertedIndexColumnWriter {
_field_name = std::wstring(field_name.begin(), field_name.end());
}

~InvertedIndexColumnWriterImpl() override = default;
~InvertedIndexColumnWriterImpl() override {
if (_index_writer != nullptr) {
close_on_error();
}
}

Status init() override {
try {
Expand All @@ -105,6 +109,7 @@ class InvertedIndexColumnWriterImpl : public InvertedIndexColumnWriter {
void close() {
if (_index_writer) {
_index_writer->close();
_index_writer.reset();
if (config::enable_write_index_searcher_cache) {
// open index searcher into cache
auto index_file_name = InvertedIndexDescriptor::get_index_file_name(
Expand Down

0 comments on commit d0e89c0

Please sign in to comment.