Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f508da9e
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,发现更多精彩内容 >>
提交
f508da9e
编写于
5月 07, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): eliminate memory leak
上级
1d8af5d4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
11 deletion
+29
-11
include/common/tcommon.h
include/common/tcommon.h
+0
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+28
-8
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-1
未找到文件。
include/common/tcommon.h
浏览文件 @
f508da9e
...
...
@@ -115,8 +115,6 @@ void* tDecodeDataBlocks(const void* buf, SArray** blocks);
void
colDataDestroy
(
SColumnInfoData
*
pColData
);
static
FORCE_INLINE
void
blockDestroyInner
(
SSDataBlock
*
pBlock
)
{
// WARNING: do not use info.numOfCols,
// sometimes info.numOfCols != array size
int32_t
numOfOutput
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
f508da9e
...
...
@@ -1225,6 +1225,8 @@ static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
taosVariantDestroy
(
&
pCtx
[
i
].
tag
);
taosMemoryFreeClear
(
pCtx
[
i
].
subsidiaries
.
pCtx
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pData
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pColumnDataAgg
);
}
taosMemoryFreeClear
(
pCtx
);
...
...
@@ -2840,9 +2842,9 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray
int32_t
setSDataBlockFromFetchRsp
(
SSDataBlock
*
pRes
,
SLoadRemoteDataInfo
*
pLoadInfo
,
int32_t
numOfRows
,
char
*
pData
,
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
SArray
*
pColList
)
{
blockDataEnsureCapacity
(
pRes
,
numOfRows
);
if
(
pColList
==
NULL
)
{
// data from other sources
blockDataEnsureCapacity
(
pRes
,
numOfRows
);
int32_t
dataLen
=
*
(
int32_t
*
)
pData
;
pData
+=
sizeof
(
int32_t
);
...
...
@@ -2898,20 +2900,23 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
pStart
+=
sizeof
(
SSysTableSchema
);
}
SSDataBlock
block
=
{.
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
)),
.
info
.
numOfCols
=
numOfCols
};
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
info
.
numOfCols
=
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
idata
=
{
0
};
idata
.
info
.
type
=
pSchema
[
i
].
type
;
idata
.
info
.
bytes
=
pSchema
[
i
].
bytes
;
idata
.
info
.
colId
=
pSchema
[
i
].
colId
;
taosArrayPush
(
block
.
pDataBlock
,
&
idata
);
taosArrayPush
(
pBlock
->
pDataBlock
,
&
idata
);
if
(
IS_VAR_DATA_TYPE
(
idata
.
info
.
type
))
{
block
.
info
.
hasVarCol
=
true
;
pBlock
->
info
.
hasVarCol
=
true
;
}
}
blockDataEnsureCapacity
(
&
b
lock
,
numOfRows
);
blockDataEnsureCapacity
(
pB
lock
,
numOfRows
);
int32_t
dataLen
=
*
(
int32_t
*
)
pStart
;
uint64_t
groupId
=
*
(
uint64_t
*
)(
pStart
+
sizeof
(
int32_t
));
...
...
@@ -2924,7 +2929,7 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
colLen
[
i
]
=
htonl
(
colLen
[
i
]);
ASSERT
(
colLen
[
i
]
>=
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
block
.
pDataBlock
,
i
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
pColInfoData
->
varmeta
.
length
=
colLen
[
i
];
pColInfoData
->
varmeta
.
allocLen
=
colLen
[
i
];
...
...
@@ -2943,7 +2948,10 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
}
// data from mnode
relocateColumnData
(
pRes
,
pColList
,
block
.
pDataBlock
);
relocateColumnData
(
pRes
,
pColList
,
pBlock
->
pDataBlock
);
taosArrayDestroy
(
pBlock
->
pDataBlock
);
taosMemoryFree
(
pBlock
);
// blockDataDestroy(pBlock);
}
pRes
->
info
.
rows
=
numOfRows
;
...
...
@@ -4184,6 +4192,17 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) {
pOperator
->
numOfDownstream
=
0
;
}
if
(
pOperator
->
pExpr
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pOperator
->
numOfExprs
;
++
i
)
{
SExprInfo
*
pExprInfo
=
&
pOperator
->
pExpr
[
i
];
if
(
pExprInfo
->
pExpr
->
nodeType
==
QUERY_NODE_COLUMN
)
{
taosMemoryFree
(
pExprInfo
->
base
.
pParam
[
0
].
pCol
);
}
taosMemoryFree
(
pExprInfo
->
base
.
pParam
);
taosMemoryFree
(
pExprInfo
->
pExpr
);
}
}
taosMemoryFree
(
pOperator
->
pExpr
);
taosMemoryFreeClear
(
pOperator
->
info
);
taosMemoryFreeClear
(
pOperator
);
...
...
@@ -4358,6 +4377,7 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
SProjectOperatorInfo
*
pInfo
=
(
SProjectOperatorInfo
*
)
param
;
doDestroyBasicInfo
(
&
pInfo
->
binfo
,
numOfOutput
);
cleanupAggSup
(
&
pInfo
->
aggSup
);
taosArrayDestroy
(
pInfo
->
pPseudoColInfo
);
}
void
destroyExchangeOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
f508da9e
...
...
@@ -1156,7 +1156,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSDataBlock* pRe
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
numOfExprs
=
pResBlock
->
info
.
numOfCols
;
pOperator
->
numOfExprs
=
pResBlock
->
info
.
numOfCols
;
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doSysTableScan
,
NULL
,
NULL
,
destroySysScanOperator
,
NULL
,
NULL
,
NULL
);
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录