You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/27 07:43:00 UTC

[doris] 09/10: [fix](memory) Fix SchemaChange memory leak due to incorrect aggfunc destroy (#19130)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.0-alpha
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 815bd50d342e324f4083a48c5924a06832b14f75
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Thu Apr 27 14:44:00 2023 +0800

    [fix](memory) Fix SchemaChange memory leak due to incorrect aggfunc destroy (#19130)
---
 be/src/olap/schema_change.cpp                       | 2 +-
 be/src/vec/aggregate_functions/aggregate_function.h | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index d96a103f2d..86c7a86f8a 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -120,7 +120,7 @@ public:
                         agg_functions[j - key_number]->insert_result_into(
                                 agg_places[j - key_number],
                                 finalized_block.get_by_position(j).column->assume_mutable_ref());
-                        agg_functions[j - key_number]->create(agg_places[j - key_number]);
+                        agg_functions[j - key_number]->reset(agg_places[j - key_number]);
                     }
 
                     if (i == rows - 1 || finalized_block.rows() == ALTER_TABLE_BATCH_SIZE) {
diff --git a/be/src/vec/aggregate_functions/aggregate_function.h b/be/src/vec/aggregate_functions/aggregate_function.h
index 2d6b07e403..ab0a7dde72 100644
--- a/be/src/vec/aggregate_functions/aggregate_function.h
+++ b/be/src/vec/aggregate_functions/aggregate_function.h
@@ -390,7 +390,10 @@ public:
     /// NOTE: Currently not used (structures with aggregation state are put without alignment).
     size_t align_of_data() const override { return alignof(Data); }
 
-    void reset(AggregateDataPtr place) const override {}
+    void reset(AggregateDataPtr place) const override {
+        destroy(place);
+        create(place);
+    }
 
     void deserialize_and_merge(AggregateDataPtr __restrict place, BufferReadable& buf,
                                Arena* arena) const override {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org