to issue<47065195>:fix memory leak of pl temp when using udf in sql stmt
This commit is contained in:
@ -631,7 +631,7 @@ class ObPLCtxGuard
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObPLCtxGuard(ObPLCtx *ctx, int& ret) : ctx_(ctx), ret_(ret) {
|
ObPLCtxGuard(ObPLCtx *ctx, int& ret) : ctx_(ctx), ret_(ret) {
|
||||||
if (OB_NOT_NULL(ctx)) {
|
if (OB_SUCCESS == ret_ && OB_NOT_NULL(ctx)) {
|
||||||
ret_ = objects_.assign(ctx->get_objects());
|
ret_ = objects_.assign(ctx->get_objects());
|
||||||
ctx_->clear();
|
ctx_->clear();
|
||||||
}
|
}
|
||||||
@ -639,7 +639,9 @@ public:
|
|||||||
|
|
||||||
~ObPLCtxGuard() {
|
~ObPLCtxGuard() {
|
||||||
if (OB_SUCCESS == ret_ && OB_NOT_NULL(ctx_)) {
|
if (OB_SUCCESS == ret_ && OB_NOT_NULL(ctx_)) {
|
||||||
ret_ = ctx_->get_objects().assign(objects_);
|
for (int64_t i = 0; OB_SUCCESS == ret_ && i < objects_.count(); ++i) {
|
||||||
|
ret_ = ctx_->add(objects_.at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,6 +522,7 @@ int ObExprUDF::eval_udf(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
|
|||||||
OZ (ctx.exec_ctx_.get_pl_ctx()->add(result));
|
OZ (ctx.exec_ctx_.get_pl_ctx()->add(result));
|
||||||
} else {
|
} else {
|
||||||
OZ (deep_copy_obj(alloc, tmp_result, result));
|
OZ (deep_copy_obj(alloc, tmp_result, result));
|
||||||
|
OX (ctx.exec_ctx_.get_pl_ctx()->reset_obj());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = tmp_result;
|
result = tmp_result;
|
||||||
|
Reference in New Issue
Block a user