From fcb555b607bffb4151661ffd9d482cf236cc587d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 3 Dec 2020 05:58:36 +0000 Subject: [PATCH] reduce mem cost --- src/client/src/tscProfile.c | 2 ++ src/client/src/tscSubquery.c | 1 + src/client/src/tscSystem.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index acc5acd786..18fc79c474 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -39,6 +39,7 @@ void tscInitConnCb(void *param, TAOS_RES *result, int code) { tscSlowQueryConnInitialized = true; tscSaveSlowQueryFp(sql, NULL); } + taos_free_result(result); } void tscAddIntoSqlList(SSqlObj *pSql) { @@ -69,6 +70,7 @@ void tscSaveSlowQueryFpCb(void *param, TAOS_RES *result, int code) { } else { tscDebug("success to save slow query, code:%d", code); } + taos_free_result(result); } void tscSaveSlowQueryFp(void *handle, void *tmrId) { diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 6ebbeeef41..4f5a9feae2 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -2197,6 +2197,7 @@ int32_t tscHandleInsertRetry(SSqlObj* pSql) { STableDataBlocks* pTableDataBlock = taosArrayGetP(pCmd->pDataBlocks, pSupporter->index); int32_t code = tscCopyDataBlockToPayload(pSql, pTableDataBlock); + pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks); if ((pRes->code = code)!= TSDB_CODE_SUCCESS) { tscQueueAsyncRes(pSql); diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 9e9a00550a..dc51482ce8 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -147,7 +147,7 @@ void taos_init_imp(void) { tscObjCache = taosCacheInit(TSDB_CACHE_PTR_KEY, refreshTime / 2, false, tscFreeRegisteredSqlObj, "sqlObj"); } - tscRefId = taosOpenRef(200, tscCloseTscObj); + tscRefId = taosOpenRef(500, tscCloseTscObj); // in other language APIs, taos_cleanup is not available yet. // So, to make sure taos_cleanup will be invoked to clean up the allocated -- GitLab