RTDatumArith memory leak
This commit is contained in:
@ -618,6 +618,26 @@ int ObAggregateProcessor::init()
|
|||||||
|
|
||||||
if (T_FUN_MEDIAN == aggr_info.get_expr_type()
|
if (T_FUN_MEDIAN == aggr_info.get_expr_type()
|
||||||
|| T_FUN_GROUP_PERCENTILE_CONT == aggr_info.get_expr_type()) {
|
|| T_FUN_GROUP_PERCENTILE_CONT == aggr_info.get_expr_type()) {
|
||||||
|
// ObAggregateProcessor::init would be invoked many times under groupby rescan
|
||||||
|
// Only create LinearInterAggrFuncCtx once to prevent memory leak.
|
||||||
|
//
|
||||||
|
// Details:
|
||||||
|
// Normally ObAggregateProcessor::init would ONLY be invoked once under open
|
||||||
|
// stage and NEVER be triggered any more. Typically window function follows
|
||||||
|
// this rule.
|
||||||
|
// However, ObAggregateProcessor::init would be invoked many times under groupby
|
||||||
|
// rescan cases, see ObGroupByOp::inner_rescan. And LinearInterAggrFuncCtx would
|
||||||
|
// be created repeatedly. This break init semantic(invoked once) and leading
|
||||||
|
// memory leak.
|
||||||
|
//
|
||||||
|
// Solution:
|
||||||
|
// Only create LinearInterAggrFuncCtx once when ObAggregateProcessor::init is called
|
||||||
|
// repeatedly. So both window function and groupby cases would be well handled.
|
||||||
|
//
|
||||||
|
// TODO qubin.qb:
|
||||||
|
// Refactor group by rescan API to stop calling ObAggregateProcessor::init so that
|
||||||
|
// init semantic (only invoke one time) would be strictly followed
|
||||||
|
if (aggr_func_ctxs_.at(i) == nullptr) {
|
||||||
LinearInterAggrFuncCtx *ctx = OB_NEWx(LinearInterAggrFuncCtx,
|
LinearInterAggrFuncCtx *ctx = OB_NEWx(LinearInterAggrFuncCtx,
|
||||||
(&eval_ctx_.exec_ctx_.get_allocator()));
|
(&eval_ctx_.exec_ctx_.get_allocator()));
|
||||||
if (NULL == ctx) {
|
if (NULL == ctx) {
|
||||||
@ -628,6 +648,7 @@ int ObAggregateProcessor::init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
// vector in case
|
// vector in case
|
||||||
|
|||||||
Reference in New Issue
Block a user