未验证 提交 1f57a5a1 编写于 作者: H Haojun Liao 提交者: GitHub

Merge pull request #17172 from taosdata/feature/3_liaohj

fix(query): fix memory leak.
......@@ -159,7 +159,7 @@ uint64_t getReaderMaxVersion(STsdbReader *pReader);
int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader);
int32_t tsdbRetrieveCacheRows(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids);
int32_t tsdbCacherowsReaderClose(void *pReader);
void* tsdbCacherowsReaderClose(void *pReader);
int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid);
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity);
......
......@@ -101,7 +101,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList
return TSDB_CODE_SUCCESS;
}
int32_t tsdbCacherowsReaderClose(void* pReader) {
void* tsdbCacherowsReaderClose(void* pReader) {
SCacheRowsReader* p = pReader;
if (p->pSchema != NULL) {
......@@ -114,7 +114,7 @@ int32_t tsdbCacherowsReaderClose(void* pReader) {
}
taosMemoryFree(pReader);
return TSDB_CODE_SUCCESS;
return NULL;
}
static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, STSRow** pRow,
......
......@@ -207,7 +207,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
}
}
tsdbCacherowsReaderClose(pInfo->pLastrowReader);
pInfo->pLastrowReader = tsdbCacherowsReaderClose(pInfo->pLastrowReader);
return pInfo->pRes;
}
}
......@@ -220,6 +220,15 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
void destroyLastrowScanOperator(void* param) {
SLastrowScanInfo* pInfo = (SLastrowScanInfo*)param;
blockDataDestroy(pInfo->pRes);
blockDataDestroy(pInfo->pBufferredRes);
taosMemoryFree(pInfo->pSlotIds);
taosArrayDestroy(pInfo->pUidList);
taosArrayDestroy(pInfo->pColMatchInfo);
if (pInfo->pLastrowReader != NULL) {
pInfo->pLastrowReader = tsdbCacherowsReaderClose(pInfo->pLastrowReader);
}
taosMemoryFreeClear(param);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册