Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a5c83c7e
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5c83c7e
编写于
7月 12, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix client memory leak
上级
558829dc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
46 addition
and
8 deletion
+46
-8
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+3
-2
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-0
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+36
-6
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+2
-0
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+2
-0
source/libs/scheduler/src/schTask.c
source/libs/scheduler/src/schTask.c
+2
-0
未找到文件。
source/client/src/clientMsgHandler.c
浏览文件 @
a5c83c7e
...
...
@@ -179,7 +179,6 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
if
(
code
!=
0
)
{
terrno
=
code
;
if
(
output
.
dbVgroup
)
taosHashCleanup
(
output
.
dbVgroup
->
vgHash
);
taosMemoryFreeClear
(
output
.
dbVgroup
);
tscError
(
"0x%"
PRIx64
" failed to build use db output since %s"
,
pRequest
->
requestId
,
terrstr
());
}
else
if
(
output
.
dbVgroup
&&
output
.
dbVgroup
->
vgHash
)
{
...
...
@@ -189,12 +188,14 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
if
(
code1
!=
TSDB_CODE_SUCCESS
)
{
tscWarn
(
"catalogGetHandle failed, clusterId:%"
PRIx64
", error:%s"
,
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
tstrerror
(
code1
));
taosMemoryFreeClear
(
output
.
dbVgroup
);
}
else
{
catalogUpdateDBVgInfo
(
pCatalog
,
output
.
db
,
output
.
dbId
,
output
.
dbVgroup
);
output
.
dbVgroup
=
NULL
;
}
}
taosMemoryFreeClear
(
output
.
dbVgroup
);
tFreeSUsedbRsp
(
&
usedbRsp
);
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
a5c83c7e
...
...
@@ -642,6 +642,7 @@ void ctgFreeSTableIndex(void *info);
void
ctgClearSubTaskRes
(
SCtgSubRes
*
pRes
);
void
ctgFreeQNode
(
SCtgQNode
*
node
);
void
ctgClearHandle
(
SCatalog
*
pCtg
);
void
ctgFreeTbCacheImpl
(
SCtgTbCache
*
pCache
);
extern
SCatalogMgmt
gCtgMgmt
;
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
a5c83c7e
...
...
@@ -647,6 +647,8 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
CTG_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
bool
syncOp
=
operation
->
syncOp
;
char
*
opName
=
gCtgCacheOperation
[
operation
->
opId
].
name
;
if
(
operation
->
syncOp
)
{
tsem_init
(
&
operation
->
rspSem
,
0
,
0
);
}
...
...
@@ -664,14 +666,14 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
gCtgMgmt
.
queue
.
tail
=
node
;
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
ctgDebug
(
"action [%s] added into queue"
,
opName
);
CTG_QUEUE_INC
();
CTG_RT_STAT_INC
(
numOfOpEnqueue
,
1
);
tsem_post
(
&
gCtgMgmt
.
queue
.
reqSem
);
ctgDebug
(
"action [%s] added into queue"
,
gCtgCacheOperation
[
operation
->
opId
].
name
);
if
(
operation
->
syncOp
)
{
if
(
syncOp
)
{
tsem_wait
(
&
operation
->
rspSem
);
taosMemoryFree
(
operation
);
}
...
...
@@ -840,6 +842,7 @@ _return:
ctgFreeVgInfo
(
dbInfo
);
taosMemoryFreeClear
(
op
->
data
);
taosMemoryFreeClear
(
op
);
CTG_RET
(
code
);
}
...
...
@@ -852,7 +855,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy
SCtgUpdateTbMetaMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgUpdateTbMetaMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateTbMetaMsg
));
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_
J
RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
char
*
p
=
strchr
(
output
->
dbFName
,
'.'
);
...
...
@@ -871,6 +874,11 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy
_return:
if
(
output
)
{
taosMemoryFree
(
output
->
tbMeta
);
taosMemoryFree
(
output
);
}
taosMemoryFreeClear
(
msg
);
CTG_RET
(
code
);
...
...
@@ -1753,6 +1761,16 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
CTG_CACHE_STAT_DEC
(
numOfStb
,
1
);
}
SCtgTbCache
*
pTbCache
=
taosHashGet
(
dbCache
->
tbCache
,
msg
->
stbName
,
strlen
(
msg
->
stbName
));
if
(
NULL
==
pTbCache
)
{
ctgDebug
(
"stb %s already not in cache"
,
msg
->
stbName
);
goto
_return
;
}
CTG_LOCK
(
CTG_WRITE
,
&
pTbCache
->
metaLock
);
ctgFreeTbCacheImpl
(
pTbCache
);
CTG_UNLOCK
(
CTG_WRITE
,
&
pTbCache
->
metaLock
);
if
(
taosHashRemove
(
dbCache
->
tbCache
,
msg
->
stbName
,
strlen
(
msg
->
stbName
)))
{
ctgError
(
"stb not exist in cache, dbFName:%s, stb:%s, suid:0x%"
PRIx64
,
msg
->
dbFName
,
msg
->
stbName
,
msg
->
suid
);
}
else
{
...
...
@@ -1780,14 +1798,24 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
SCtgDBCache
*
dbCache
=
NULL
;
ctgGetDBCache
(
pCtg
,
msg
->
dbFName
,
&
dbCache
);
if
(
NULL
==
dbCache
)
{
return
TSDB_CODE_SUCCESS
;
goto
_return
;
}
if
(
dbCache
->
dbId
!=
msg
->
dbId
)
{
ctgDebug
(
"dbId 0x%"
PRIx64
" not match with curId 0x%"
PRIx64
", dbFName:%s, tbName:%s"
,
msg
->
dbId
,
dbCache
->
dbId
,
msg
->
dbFName
,
msg
->
tbName
);
return
TSDB_CODE_SUCCESS
;
goto
_return
;
}
SCtgTbCache
*
pTbCache
=
taosHashGet
(
dbCache
->
tbCache
,
msg
->
tbName
,
strlen
(
msg
->
tbName
));
if
(
NULL
==
pTbCache
)
{
ctgDebug
(
"tb %s already not in cache"
,
msg
->
tbName
);
goto
_return
;
}
CTG_LOCK
(
CTG_WRITE
,
&
pTbCache
->
metaLock
);
ctgFreeTbCacheImpl
(
pTbCache
);
CTG_UNLOCK
(
CTG_WRITE
,
&
pTbCache
->
metaLock
);
if
(
taosHashRemove
(
dbCache
->
tbCache
,
msg
->
tbName
,
strlen
(
msg
->
tbName
)))
{
ctgError
(
"tb %s not exist in cache, dbFName:%s"
,
msg
->
tbName
,
msg
->
dbFName
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
...
...
@@ -2063,6 +2091,8 @@ void* ctgUpdateThreadFunc(void* param) {
if
(
operation
->
syncOp
)
{
tsem_post
(
&
operation
->
rspSem
);
}
else
{
taosMemoryFreeClear
(
operation
);
}
CTG_RT_STAT_INC
(
numOfOpDequeue
,
1
);
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
a5c83c7e
...
...
@@ -261,6 +261,8 @@ int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
_return:
taosMemoryFree
(
pMsg
->
pData
);
if
(
pJob
)
{
taosReleaseRef
(
gCtgMgmt
.
jobPool
,
cbParam
->
refId
);
}
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
a5c83c7e
...
...
@@ -152,6 +152,7 @@ void ctgFreeStbMetaCache(SCtgDBCache *dbCache) {
}
void
ctgFreeTbCacheImpl
(
SCtgTbCache
*
pCache
)
{
qDebug
(
"tbMeta freed, p:%p"
,
pCache
->
pMeta
);
taosMemoryFreeClear
(
pCache
->
pMeta
);
if
(
pCache
->
pIndex
)
{
taosArrayDestroyEx
(
pCache
->
pIndex
->
pIndex
,
tFreeSTableIndexInfo
);
...
...
@@ -831,6 +832,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput)
if
(
output
->
tbMeta
)
{
int32_t
metaSize
=
CTG_META_SIZE
(
output
->
tbMeta
);
(
*
pOutput
)
->
tbMeta
=
taosMemoryMalloc
(
metaSize
);
qDebug
(
"tbMeta cloned, size:%d, p:%p"
,
metaSize
,
(
*
pOutput
)
->
tbMeta
);
if
(
NULL
==
(
*
pOutput
)
->
tbMeta
)
{
qError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
taosMemoryFreeClear
(
*
pOutput
);
...
...
source/libs/scheduler/src/schTask.c
浏览文件 @
a5c83c7e
...
...
@@ -41,6 +41,8 @@ void schFreeTask(SSchJob *pJob, SSchTask *pTask) {
if
(
pTask
->
execNodes
)
{
taosHashCleanup
(
pTask
->
execNodes
);
}
taosMemoryFree
(
pTask
->
profile
.
execTime
);
}
int32_t
schInitTask
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
SSubplan
*
pPlan
,
SSchLevel
*
pLevel
,
int32_t
levelNum
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录