提交 2b5d8922 编写于 作者: O obdev 提交者: ob-robot

[to #47336750] fix memory leak of package variable serialize

上级 adce321d
......@@ -758,7 +758,7 @@ int ObPLPackageManager::set_package_var_val(const ObPLResolveCtx &resolve_ctx,
ret = OB_ERR_NUMERIC_OR_VALUE_ERROR;
LOG_WARN("not null check violated", K(var->is_not_null()), K(var_val.is_null()), K(ret));
}
OZ (package_state->set_package_var_val(var_idx, new_var_val));
OZ (package_state->set_package_var_val(var_idx, new_var_val, !need_deserialize));
if (!need_deserialize) {
OZ (package_state->update_changed_vars(var_idx));
}
......
......@@ -183,7 +183,7 @@ void ObPLPackageState::reset(ObSQLSessionInfo *session_info)
cursor_allocator_.reset();
}
int ObPLPackageState::set_package_var_val(const int64_t var_idx, const ObObj &value)
int ObPLPackageState::set_package_var_val(const int64_t var_idx, const ObObj &value, bool deep_copy_complex)
{
int ret = OB_SUCCESS;
if (var_idx < 0 || var_idx >= vars_.count()) {
......@@ -199,7 +199,10 @@ int ObPLPackageState::set_package_var_val(const int64_t var_idx, const ObObj &va
LOG_WARN("failed to alloc memory for pacakge var", K(ret), K(buf));
}
OZ (vars_.at(var_idx).deep_copy(value, buf, value.get_deep_copy_size(), pos));
} else if (value.is_pl_extend()) {
} else if (value.is_pl_extend()
&& value.get_meta().get_extend_type() != PL_CURSOR_TYPE
&& value.get_meta().get_extend_type() != PL_REF_CURSOR_TYPE
&& deep_copy_complex) {
ObObj copy;
OZ (ObUserDefinedType::deep_copy_obj(inner_allocator_, value, copy));
OX (vars_.at(var_idx) = copy);
......
......@@ -134,7 +134,7 @@ public:
common::ObIAllocator &get_pkg_allocator() { return inner_allocator_; }
common::ObIAllocator &get_pkg_cursor_allocator() { return cursor_allocator_; }
int add_package_var_val(const common::ObObj &value, ObPLType type);
int set_package_var_val(int64_t var_idx, const common::ObObj &value);
int set_package_var_val(int64_t var_idx, const common::ObObj &value, bool deep_copy_complex = true);
int get_package_var_val(int64_t var_idx, common::ObObj &value);
int update_changed_vars(int64_t var_idx);
inline bool is_package_info_changed()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册