Merge pull request #17172 from taosdata/feature/3_liaohj
fix(query): fix memory leak.
This commit is contained in:
commit
1f57a5a1cc
|
@ -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 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 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);
|
int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid);
|
||||||
|
|
||||||
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity);
|
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;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCacherowsReaderClose(void* pReader) {
|
void* tsdbCacherowsReaderClose(void* pReader) {
|
||||||
SCacheRowsReader* p = pReader;
|
SCacheRowsReader* p = pReader;
|
||||||
|
|
||||||
if (p->pSchema != NULL) {
|
if (p->pSchema != NULL) {
|
||||||
|
@ -114,7 +114,7 @@ int32_t tsdbCacherowsReaderClose(void* pReader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(pReader);
|
taosMemoryFree(pReader);
|
||||||
return TSDB_CODE_SUCCESS;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, STSRow** pRow,
|
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;
|
return pInfo->pRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,15 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
||||||
void destroyLastrowScanOperator(void* param) {
|
void destroyLastrowScanOperator(void* param) {
|
||||||
SLastrowScanInfo* pInfo = (SLastrowScanInfo*)param;
|
SLastrowScanInfo* pInfo = (SLastrowScanInfo*)param;
|
||||||
blockDataDestroy(pInfo->pRes);
|
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);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue