[CP] [FIX] Fix problem of memory leak in RCTE when encounter large memory allocation
This commit is contained in:
@ -526,6 +526,7 @@ int ObBreadthFirstSearchBulkOp::reuse()
|
|||||||
|
|
||||||
void ObBreadthFirstSearchBulkOp::destroy()
|
void ObBreadthFirstSearchBulkOp::destroy()
|
||||||
{
|
{
|
||||||
|
free_input_rows_mem();
|
||||||
free_last_iter_mem();
|
free_last_iter_mem();
|
||||||
if (OB_NOT_NULL(mem_context_)) {
|
if (OB_NOT_NULL(mem_context_)) {
|
||||||
DESTROY_CONTEXT(mem_context_);
|
DESTROY_CONTEXT(mem_context_);
|
||||||
@ -812,6 +813,22 @@ int ObBreadthFirstSearchBulkOp::init_mem_context()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//RCTE operator may encounter -4013 memory problem when it want to allocate a very large memory for a new round of iteration data
|
||||||
|
//at that time, memory is stored in input_rows_, so we have to free them before reset allocator
|
||||||
|
void ObBreadthFirstSearchBulkOp::free_input_rows_mem()
|
||||||
|
{
|
||||||
|
if (OB_ISNULL(malloc_allocator_)) {
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
|
for (int64_t i = 0; i < input_rows_.size(); ++i) {
|
||||||
|
if (OB_NOT_NULL(input_rows_.at(i))) {
|
||||||
|
malloc_allocator_->free(input_rows_.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
input_rows_.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ObBreadthFirstSearchBulkOp::free_last_iter_mem()
|
void ObBreadthFirstSearchBulkOp::free_last_iter_mem()
|
||||||
{
|
{
|
||||||
if (OB_ISNULL(malloc_allocator_)) {
|
if (OB_ISNULL(malloc_allocator_)) {
|
||||||
|
|||||||
@ -333,6 +333,7 @@ public:
|
|||||||
int sort_result_output_nodes(int64_t rows_cnt);
|
int sort_result_output_nodes(int64_t rows_cnt);
|
||||||
int add_row(const ObIArray<ObExpr *> &exprs, ObEvalCtx &eval_ctx);
|
int add_row(const ObIArray<ObExpr *> &exprs, ObEvalCtx &eval_ctx);
|
||||||
int init_mem_context();
|
int init_mem_context();
|
||||||
|
void free_input_rows_mem();
|
||||||
void free_last_iter_mem();
|
void free_last_iter_mem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user