This is an automated email from the ASF dual-hosted git repository.
zhangchen pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 7887f51e9b9 [fix](partial update) fix a mem leak issue (#37706)
(#37730)
7887f51e9b9 is described below
commit 7887f51e9b9103a6527d4f6553247ccb285b0392
Author: zhannngchen <[email protected]>
AuthorDate: Sat Jul 13 09:20:01 2024 +0800
[fix](partial update) fix a mem leak issue (#37706) (#37730)
cherry-pick #37706
---
be/src/olap/tablet.cpp | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 0a791614b87..aa7594f1e10 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2901,22 +2901,20 @@ Status Tablet::sort_block(vectorized::Block& in_block,
vectorized::Block& output
vectorized::MutableBlock mutable_output_block =
vectorized::MutableBlock::build_mutable_block(&output_block);
- std::vector<RowInBlock*> _row_in_blocks;
- _row_in_blocks.reserve(in_block.rows());
-
std::shared_ptr<RowInBlockComparator> vec_row_comparator =
std::make_shared<RowInBlockComparator>(_tablet_meta->tablet_schema().get());
vec_row_comparator->set_block(&mutable_input_block);
- std::vector<RowInBlock*> row_in_blocks;
+ std::vector<std::unique_ptr<RowInBlock>> row_in_blocks;
DCHECK(in_block.rows() <= std::numeric_limits<int>::max());
row_in_blocks.reserve(in_block.rows());
for (size_t i = 0; i < in_block.rows(); ++i) {
- row_in_blocks.emplace_back(new RowInBlock {i});
+ row_in_blocks.emplace_back(std::make_unique<RowInBlock>(i));
}
std::sort(row_in_blocks.begin(), row_in_blocks.end(),
- [&](const RowInBlock* l, const RowInBlock* r) -> bool {
- auto value = (*vec_row_comparator)(l, r);
+ [&](const std::unique_ptr<RowInBlock>& l,
+ const std::unique_ptr<RowInBlock>& r) -> bool {
+ auto value = (*vec_row_comparator)(l.get(), r.get());
DCHECK(value != 0) << "value equel when sort block, l_pos: "
<< l->_row_pos
<< " r_pos: " << r->_row_pos;
return value < 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]