This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 8789050530622eb718ae31cbc06871565fa19e42 Author: Xinyi Zou <zouxiny...@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 5a2db1138b..12c9ce5853 100644 --- a/be/src/olap/schema_change.cpp +++ b/be/src/olap/schema_change.cpp @@ -159,7 +159,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 6309b0c994..1a35167193 100644 --- a/be/src/vec/aggregate_functions/aggregate_function.h +++ b/be/src/vec/aggregate_functions/aggregate_function.h @@ -395,7 +395,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-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org