Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5ddc7b45
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看板
提交
5ddc7b45
编写于
1月 09, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory leaks and refactor some codes
上级
2c393a89
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
65 addition
and
36 deletion
+65
-36
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+16
-15
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+5
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+44
-20
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
5ddc7b45
...
...
@@ -251,10 +251,10 @@ typedef struct {
int32_t
clauseIndex
;
// index of multiple subclause query
int8_t
isParseFinish
;
short
numOfCols
;
uint32_t
allocSize
;
char
*
payload
;
int
payloadLen
;
SQueryInfo
**
pQueryInfo
;
int32_t
numOfClause
;
...
...
@@ -413,6 +413,7 @@ int32_t tscCreateResPointerInfo(SQueryInfo *pQueryInfo, SSqlRes *pRes);
void
tscDestroyResPointerInfo
(
SSqlRes
*
pRes
);
void
tscFreeSqlCmdData
(
SSqlCmd
*
pCmd
);
void
tscFreeResData
(
SSqlObj
*
pSql
);
/**
* only free part of resources allocated during query.
...
...
@@ -435,7 +436,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql);
void
tscKillMetricQuery
(
SSqlObj
*
pSql
);
void
tscInitResObjForLocalQuery
(
SSqlObj
*
pObj
,
int32_t
numOfRes
,
int32_t
rowLen
);
bool
tscIsUpdateQuery
(
STscObj
*
pObj
);
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
);
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
);
char
*
tscGetErrorMsgPayload
(
SSqlCmd
*
pCmd
);
...
...
src/client/src/tscSecondaryMerge.c
浏览文件 @
5ddc7b45
...
...
@@ -453,6 +453,10 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
SQLFunctionCtx
*
pCtx
=
&
pLocalReducer
->
pCtx
[
i
];
tVariantDestroy
(
&
pCtx
->
tag
);
if
(
pCtx
->
tagInfo
.
pTagCtxList
!=
NULL
)
{
tfree
(
pCtx
->
tagInfo
.
pTagCtxList
);
}
}
tfree
(
pLocalReducer
->
pCtx
);
...
...
src/client/src/tscUtil.c
浏览文件 @
5ddc7b45
...
...
@@ -365,6 +365,39 @@ void tscFreeSqlCmdData(SSqlCmd* pCmd) {
tscFreeSubqueryInfo
(
pCmd
);
}
void
tscFreeResData
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
tfree
(
pRes
->
pRsp
);
pRes
->
row
=
0
;
pRes
->
rspType
=
0
;
pRes
->
rspLen
=
0
;
pRes
->
row
=
0
;
pRes
->
numOfRows
=
0
;
pRes
->
numOfTotal
=
0
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
numOfGroups
=
0
;
pRes
->
precision
=
0
;
pRes
->
numOfnchar
=
0
;
pRes
->
qhandle
=
0
;
pRes
->
offset
=
0
;
pRes
->
useconds
=
0
;
pRes
->
code
=
0
;
pRes
->
data
=
NULL
;
tfree
(
pRes
->
pGroupRec
);
tscDestroyLocalReducer
(
pSql
);
tscDestroyResPointerInfo
(
pRes
);
tfree
(
pRes
->
pColumnIndex
);
}
void
tscFreeSqlObjPartial
(
SSqlObj
*
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
return
;
...
...
@@ -388,21 +421,10 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) {
tfree
(
pSql
->
sqlstr
);
pthread_mutex_unlock
(
&
pObj
->
mutex
);
tfree
(
pRes
->
pRsp
);
pRes
->
row
=
0
;
pRes
->
numOfRows
=
0
;
pRes
->
numOfTotal
=
0
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
numOfGroups
=
0
;
tfree
(
pRes
->
pGroupRec
);
tscDestroyLocalReducer
(
pSql
);
tscFreeResData
(
pSql
);
tfree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
tscDestroyResPointerInfo
(
pRes
);
tfree
(
pRes
->
pColumnIndex
);
tscFreeSqlCmdData
(
pCmd
);
}
...
...
@@ -2156,12 +2178,14 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
pSql
->
cmd
.
command
=
pQueryInfo
->
command
;
pRes
->
numOfTotal
+=
pRes
->
numOfTotalInCurrentClause
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
rspType
=
0
;
//backup the total number of result first
int64_t
num
=
pRes
->
numOfTotal
+
pRes
->
numOfTotalInCurrentClause
;
tscFreeResData
(
pSql
);
pRes
->
numOfTotal
=
num
;
pSql
->
numOfSubs
=
0
;
tfree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
if
(
pSql
->
fp
!=
NULL
)
{
pSql
->
fp
=
queryFp
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录