Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9ec14ece
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9ec14ece
编写于
7月 16, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix taosd mem leak
上级
1e38a46e
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
34 addition
and
32 deletion
+34
-32
include/libs/function/function.h
include/libs/function/function.h
+1
-6
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-0
source/libs/executor/src/dataInserter.c
source/libs/executor/src/dataInserter.c
+3
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+3
-1
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+2
-0
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-0
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+19
-21
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+1
-1
tests/script/tsim/valgrind/basic1.sim
tests/script/tsim/valgrind/basic1.sim
+2
-3
未找到文件。
include/libs/function/function.h
浏览文件 @
9ec14ece
...
...
@@ -172,13 +172,8 @@ typedef struct tExprNode {
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
typedef
enum
{
SHOULD_FREE_COLDATA
=
0x1
,
// the newly created column data needs to be destroyed.
DELEGATED_MGMT_COLDATA
=
0x2
,
// input column data should not be released.
}
ECOLDATA_MGMT_TYPE_E
;
struct
SScalarParam
{
ECOLDATA_MGMT_TYPE_E
type
;
bool
colAlloced
;
SColumnInfoData
*
columnData
;
SHashObj
*
pHashFilter
;
int32_t
hashValueType
;
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
9ec14ece
...
...
@@ -3186,6 +3186,7 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6
*
suid
=
0
;
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
tDecoderClear
(
&
mr
.
coder
);
*
suid
=
mr
.
me
.
ctbEntry
.
suid
;
code
=
metaGetTableEntryByUid
(
&
mr
,
*
suid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/executor/src/dataInserter.c
浏览文件 @
9ec14ece
...
...
@@ -90,6 +90,7 @@ _return:
tsem_post
(
&
pInserter
->
ready
);
taosMemoryFree
(
pMsg
->
pData
);
taosMemoryFree
(
param
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -283,6 +284,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
atomic_sub_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pInserter
->
cachedSize
);
taosArrayDestroy
(
pInserter
->
pDataBlocks
);
taosMemoryFree
(
pInserter
->
pSchema
);
taosMemoryFree
(
pInserter
->
pParam
);
taosHashCleanup
(
pInserter
->
pCols
);
taosThreadMutexDestroy
(
&
pInserter
->
mutex
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
9ec14ece
...
...
@@ -624,6 +624,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
ASSERT
(
pResult
->
info
.
capacity
>
0
);
colDataMergeCol
(
pResColData
,
startOffset
,
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
colDataDestroy
(
&
idata
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
@@ -679,6 +680,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
ASSERT
(
pResult
->
info
.
capacity
>
0
);
colDataMergeCol
(
pResColData
,
startOffset
,
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
colDataDestroy
(
&
idata
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
9ec14ece
...
...
@@ -234,6 +234,7 @@ void destroyOrderOperatorInfo(void* param, int32_t numOfOutput) {
SSortOperatorInfo
*
pInfo
=
(
SSortOperatorInfo
*
)
param
;
pInfo
->
binfo
.
pRes
=
blockDataDestroy
(
pInfo
->
binfo
.
pRes
);
tsortDestroySortHandle
(
pInfo
->
pSortHandle
);
taosArrayDestroy
(
pInfo
->
pSortInfo
);
taosArrayDestroy
(
pInfo
->
pColMatchInfo
);
...
...
@@ -674,6 +675,7 @@ void destroyMultiwayMergeOperatorInfo(void* param, int32_t numOfOutput) {
pInfo
->
binfo
.
pRes
=
blockDataDestroy
(
pInfo
->
binfo
.
pRes
);
pInfo
->
pInputBlock
=
blockDataDestroy
(
pInfo
->
pInputBlock
);
tsortDestroySortHandle
(
pInfo
->
pSortHandle
);
taosArrayDestroy
(
pInfo
->
pSortInfo
);
taosArrayDestroy
(
pInfo
->
pColMatchInfo
);
...
...
source/libs/function/src/tudf.c
浏览文件 @
9ec14ece
...
...
@@ -855,6 +855,7 @@ int32_t convertDataBlockToScalarParm(SSDataBlock *input, SScalarParam *output) {
memcpy
(
output
->
columnData
,
taosArrayGet
(
input
->
pDataBlock
,
0
),
sizeof
(
SColumnInfoData
));
output
->
colAlloced
=
true
;
return
0
;
}
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
9ec14ece
...
...
@@ -952,6 +952,7 @@ void nodesDestroyNode(SNode* pNode) {
case
QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT
:
{
SQueryInserterNode
*
pSink
=
(
SQueryInserterNode
*
)
pNode
;
destroyDataSinkNode
((
SDataSinkNode
*
)
pSink
);
nodesDestroyList
(
pSink
->
pCols
);
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_DELETE
:
{
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
9ec14ece
...
...
@@ -55,7 +55,7 @@ int32_t sclCreateColumnInfoData(SDataType* pType, int32_t numOfRows, SScalarPara
}
pParam
->
columnData
=
pColumnData
;
pParam
->
type
=
SHOULD_FREE_COLDATA
;
pParam
->
colAlloced
=
true
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -166,7 +166,7 @@ void sclFreeRes(SHashObj *res) {
}
void
sclFreeParam
(
SScalarParam
*
param
)
{
if
(
param
->
columnData
!=
NULL
)
{
if
(
param
->
columnData
!=
NULL
&&
param
->
colAlloced
)
{
colDataDestroy
(
param
->
columnData
);
taosMemoryFreeClear
(
param
->
columnData
);
}
...
...
@@ -191,6 +191,19 @@ int32_t sclCopyValueNodeValue(SValueNode *pNode, void **res) {
return
TSDB_CODE_SUCCESS
;
}
void
sclFreeParamList
(
SScalarParam
*
param
,
int32_t
paramNum
)
{
if
(
NULL
==
param
)
{
return
;
}
for
(
int32_t
i
=
0
;
i
<
paramNum
;
++
i
)
{
SScalarParam
*
p
=
param
+
i
;
sclFreeParam
(
p
);
}
taosMemoryFree
(
param
);
}
int32_t
sclInitParam
(
SNode
*
node
,
SScalarParam
*
param
,
SScalarCtx
*
ctx
,
int32_t
*
rowNum
)
{
switch
(
nodeType
(
node
))
{
case
QUERY_NODE_LEFT_VALUE
:
{
...
...
@@ -274,6 +287,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
SCL_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
*
param
=
*
res
;
param
->
colAlloced
=
false
;
break
;
}
default:
...
...
@@ -455,11 +469,7 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp
_return:
for
(
int32_t
i
=
0
;
i
<
paramNum
;
++
i
)
{
// sclFreeParamNoData(params + i);
}
taosMemoryFreeClear
(
params
);
sclFreeParamList
(
params
,
paramNum
);
SCL_RET
(
code
);
}
...
...
@@ -533,11 +543,7 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
_return:
for
(
int32_t
i
=
0
;
i
<
paramNum
;
++
i
)
{
// sclFreeParamNoData(params + i);
}
taosMemoryFreeClear
(
params
);
sclFreeParamList
(
params
,
paramNum
);
SCL_RET
(
code
);
}
...
...
@@ -573,14 +579,8 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp
code
=
terrno
;
_return:
for
(
int32_t
i
=
0
;
i
<
paramNum
;
++
i
)
{
if
(
params
[
i
].
type
==
SHOULD_FREE_COLDATA
)
{
colDataDestroy
(
params
[
i
].
columnData
);
taosMemoryFreeClear
(
params
[
i
].
columnData
);
}
}
taosMemoryFreeClear
(
params
);
sclFreeParamList
(
params
,
paramNum
);
SCL_RET
(
code
);
}
...
...
@@ -871,7 +871,6 @@ EDealRes sclWalkFunction(SNode* pNode, SScalarCtx *ctx) {
return
DEAL_RES_ERROR
;
}
output
.
type
=
DELEGATED_MGMT_COLDATA
;
if
(
taosHashPut
(
ctx
->
pRes
,
&
pNode
,
POINTER_BYTES
,
&
output
,
sizeof
(
output
)))
{
ctx
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
DEAL_RES_ERROR
;
...
...
@@ -906,7 +905,6 @@ EDealRes sclWalkOperator(SNode* pNode, SScalarCtx *ctx) {
return
DEAL_RES_ERROR
;
}
output
.
type
=
DELEGATED_MGMT_COLDATA
;
if
(
taosHashPut
(
ctx
->
pRes
,
&
pNode
,
POINTER_BYTES
,
&
output
,
sizeof
(
output
)))
{
ctx
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
DEAL_RES_ERROR
;
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
9ec14ece
...
...
@@ -207,7 +207,7 @@ void flttMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) {
void
initScalarParam
(
SScalarParam
*
pParam
)
{
memset
(
pParam
,
0
,
sizeof
(
SScalarParam
));
pParam
->
type
=
SHOULD_FREE_COLDATA
;
pParam
->
colAlloced
=
true
;
}
}
...
...
tests/script/tsim/valgrind/basic1.sim
浏览文件 @
9ec14ece
...
...
@@ -21,12 +21,11 @@ sql create table tb4 using st1 tags(4);
sql insert into tb4 select * from tb1;
goto _OVER
sql select * from tb4;
if $rows != 2 then
return -1
endi
sql insert into tb4 select ts,f1,f2 from st1;
sql select * from tb4;
if $rows != 6 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录