This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/dev-1.0.1 by this push:
new bfe606602f [fix] fix agg_memleak (#10571)
bfe606602f is described below
commit bfe606602fbd6bb235f35a865d2b6e105bb0f2fb
Author: zy-kkk <[email protected]>
AuthorDate: Sun Jul 3 20:22:26 2022 +0800
[fix] fix agg_memleak (#10571)
The previous code did not call 'destroy' to release the resource after the'
create 'operation,
resulting in a memory leak. So I added Destroy
---
be/src/vec/exec/vaggregation_node.cpp | 14 +++++++++-----
be/src/vec/exec/vaggregation_node.h | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/be/src/vec/exec/vaggregation_node.cpp
b/be/src/vec/exec/vaggregation_node.cpp
index 66f6037715..29983cf374 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -421,7 +421,7 @@ Status AggregationNode::_create_agg_status(AggregateDataPtr
data) {
return Status::OK();
}
-Status AggregationNode::_destory_agg_status(AggregateDataPtr data) {
+Status AggregationNode::_destroy_agg_status(AggregateDataPtr data) {
for (int i = 0; i < _aggregate_evaluators.size(); ++i) {
_aggregate_evaluators[i]->function()->destroy(data +
_offsets_of_aggregate_states[i]);
}
@@ -556,7 +556,7 @@ Status AggregationNode::_merge_without_key(Block* block) {
deserialize_buffer.get() +
_offsets_of_aggregate_states[i],
&_agg_arena_pool);
- _destory_agg_status(deserialize_buffer.get());
+ _destroy_agg_status(deserialize_buffer.get());
}
} else {
_aggregate_evaluators[i]->execute_single_add(
@@ -572,7 +572,7 @@ void AggregationNode::_update_memusage_without_key() {
}
void AggregationNode::_close_without_key() {
- _destory_agg_status(_agg_data.without_key);
+ _destroy_agg_status(_agg_data.without_key);
release_tracker();
}
@@ -720,6 +720,10 @@ Status
AggregationNode::_pre_agg_with_serialized_key(doris::vectorized::Block* i
}
}
+ for (size_t i = 0; i < rows; ++i) {
+ _destroy_agg_status(_streaming_pre_places[i]);
+ }
+
if (!mem_reuse) {
ColumnsWithTypeAndName columns_with_schema;
for (int i = 0; i < key_size; ++i) {
@@ -1082,7 +1086,7 @@ Status AggregationNode::_merge_with_serialized_key(Block*
block) {
deserialize_buffer.get() +
_offsets_of_aggregate_states[i],
&_agg_arena_pool);
- _destory_agg_status(deserialize_buffer.get());
+ _destroy_agg_status(deserialize_buffer.get());
}
} else {
_aggregate_evaluators[i]->execute_batch_add(block,
_offsets_of_aggregate_states[i],
@@ -1111,7 +1115,7 @@ void AggregationNode::_close_with_serialized_key() {
auto& data = agg_method.data;
data.for_each_mapped([&](auto& mapped) {
if (mapped) {
- _destory_agg_status(mapped);
+ _destroy_agg_status(mapped);
mapped = nullptr;
}
});
diff --git a/be/src/vec/exec/vaggregation_node.h
b/be/src/vec/exec/vaggregation_node.h
index d46f856f8b..c6d6c34b1c 100644
--- a/be/src/vec/exec/vaggregation_node.h
+++ b/be/src/vec/exec/vaggregation_node.h
@@ -465,7 +465,7 @@ private:
void _make_nullable_output_key(Block* block);
Status _create_agg_status(AggregateDataPtr data);
- Status _destory_agg_status(AggregateDataPtr data);
+ Status _destroy_agg_status(AggregateDataPtr data);
Status _get_without_key_result(RuntimeState* state, Block* block, bool*
eos);
Status _serialize_without_key(RuntimeState* state, Block* block, bool*
eos);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]