You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/14 01:21:55 UTC
[GitHub] [incubator-doris] yiguolei commented on a diff in pull request #9560: fix memory leak
yiguolei commented on code in PR #9560:
URL: https://github.com/apache/incubator-doris/pull/9560#discussion_r872909123
##########
be/src/vec/exprs/vexpr_context.cpp:
##########
@@ -30,6 +30,13 @@ VExprContext::VExprContext(VExpr* expr)
_closed(false),
_last_result_column_id(-1) {}
+VExprContext::~VExprContext() {
+ DCHECK(!_prepared || _closed);
+ for (int i = 0; i < _fn_contexts.size(); ++i) {
+ delete _fn_contexts[i];
+ }
Review Comment:
Although this is a problem. But I do not think it is the root cause for your memory leak. Because
void VExprContext::close(doris::RuntimeState* state) {
DCHECK(!_closed);
FunctionContext::FunctionStateScope scope =
_is_clone ? FunctionContext::THREAD_LOCAL : FunctionContext::FRAGMENT_LOCAL;
_root->close(state, this, scope);
for (int i = 0; i < _fn_contexts.size(); ++i) {
_fn_contexts[i]->impl()->close();
delete _fn_contexts[i];
}
// _pool can be NULL if Prepare() was never called
if (_pool != NULL) {
_pool->free_all();
}
_closed = true;
}
the close method will delete every _fn_contexts[i]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org