---
title: UDT 模块内存泄漏导致 plan cache 用满-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于 UDT 模块内存泄漏导致 plan cache 用满相关的常见问题和使用技巧，帮助您快速解决 UDT 模块内存泄漏导致 plan cache 用满的难题。
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# UDT 模块内存泄漏导致 plan cache 用满

更新时间：2026-05-08 08:11

适用版本： V3.2.x 内容类型：Troubleshoot  

## 适用版本

OceanBase 数据库 V3.2.3.3 版本

## 问题现象

`Plan cache memory used reach limit（5226）` 报错，日志如下。

```shell
observer218.log:[2023-02-09 16:45:49.519610] INFO [SQL.PC] ob_plan_cache.cpp:1351 [3910415][0][Y0-0000000000000000-0-0] [lt=25] [dc=0] plan cache evict info(tenant_id=1014, mem_hold=1314914304, mem_limit=1073741820, plan_num=1, pcv_set_num=1)
observer218.log:[2023-02-09 16:45:49.522629] INFO [SQL.PC] ob_plan_cache.cpp:1583 [3910415][0][Y0-0000000000000000-0-0] [lt=7] [dc=0] actual evict number(evict_value_num=0)

```

登录 SYS 租户，通过下述命令刷新整个集群的 plan cache，依然无法清理。

```shell
obclient> alter system flush plan cache global;

```

## 问题原因

UDT（user defined type）模块在编译时出现内存泄漏：在执行包含 UDT 的 SQL 时，编译执行 SQL 会在 plan cache 内缓存 UDT 的编译对象，但是当该 plan 对象被淘汰时，UDT 对象的相关内存没有完全释放。当系统中大量编译执行包含 UDT 的 SQL（可能是因为编译失败而反复重试），可能导致 Plan Cache 的内存泄漏。

## 解决方法

### 应急处理方法

- 重启 OBServer 进程，释放内存。
 - 找出编译失败的 UDT 并解决，规避内存泄漏问题的发生。

### 解决方法

升级到 OceanBase 数据库 V3.2.3 BP8 或者以上版本。

上一篇

[add_plan 报错： -5226 plan cache memory used reach limit](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000209936)

下一篇

[线程析构时线程局部缓存 ObDecoderCtxArray 内存泄漏](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000030747) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
