fix memory leaks
This commit is contained in:
parent
3a9c82899c
commit
20dbf100de
|
@ -440,8 +440,7 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
|
||||||
tscTrace("%p waiting for delete procedure, status: %d", pSql, status);
|
tscTrace("%p waiting for delete procedure, status: %d", pSql, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(pLocalReducer->interpolationInfo.prevValues);
|
taosDestoryInterpoInfo(&pLocalReducer->interpolationInfo);
|
||||||
tfree(pLocalReducer->interpolationInfo.pTags);
|
|
||||||
|
|
||||||
if (pLocalReducer->pCtx != NULL) {
|
if (pLocalReducer->pCtx != NULL) {
|
||||||
for(int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) {
|
for(int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) {
|
||||||
|
|
|
@ -38,13 +38,13 @@ typedef struct SPoint {
|
||||||
void * val;
|
void * val;
|
||||||
} SPoint;
|
} SPoint;
|
||||||
|
|
||||||
typedef void (*__interpo_callback_fn_t)(void *param);
|
|
||||||
|
|
||||||
int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t timeRange, char intervalTimeUnit, int16_t precision);
|
int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t timeRange, char intervalTimeUnit, int16_t precision);
|
||||||
|
|
||||||
void taosInitInterpoInfo(SInterpolationInfo *pInterpoInfo, int32_t order, int64_t startTimeStamp, int32_t numOfTags,
|
void taosInitInterpoInfo(SInterpolationInfo *pInterpoInfo, int32_t order, int64_t startTimeStamp, int32_t numOfTags,
|
||||||
int32_t rowSize);
|
int32_t rowSize);
|
||||||
|
|
||||||
|
void taosDestoryInterpoInfo(SInterpolationInfo *pInterpoInfo);
|
||||||
|
|
||||||
void taosInterpoSetStartInfo(SInterpolationInfo *pInterpoInfo, int32_t numOfRawDataInRows, int32_t type);
|
void taosInterpoSetStartInfo(SInterpolationInfo *pInterpoInfo, int32_t numOfRawDataInRows, int32_t type);
|
||||||
|
|
||||||
TSKEY taosGetRevisedEndKey(TSKEY ekey, int32_t order, int32_t timeInterval, int8_t intervalTimeUnit, int8_t precision);
|
TSKEY taosGetRevisedEndKey(TSKEY ekey, int32_t order, int32_t timeInterval, int8_t intervalTimeUnit, int8_t precision);
|
||||||
|
@ -78,8 +78,8 @@ int32_t taosNumOfRemainPoints(SInterpolationInfo *pInterpoInfo);
|
||||||
*/
|
*/
|
||||||
int32_t taosDoInterpoResult(SInterpolationInfo *pInterpoInfo, int16_t interpoType, tFilePage **data,
|
int32_t taosDoInterpoResult(SInterpolationInfo *pInterpoInfo, int16_t interpoType, tFilePage **data,
|
||||||
int32_t numOfRawDataInRows, int32_t outputRows, int64_t nInterval,
|
int32_t numOfRawDataInRows, int32_t outputRows, int64_t nInterval,
|
||||||
int64_t *pPrimaryKeyArray, tColModel *pModel, char **srcData, int64_t *defaultVal,
|
const int64_t *pPrimaryKeyArray, tColModel *pModel, char **srcData, int64_t *defaultVal,
|
||||||
int32_t *functionIDs, int32_t bufSize);
|
const int32_t *functionIDs, int32_t bufSize);
|
||||||
|
|
||||||
int taosDoLinearInterpolation(int32_t type, SPoint *point1, SPoint *point2, SPoint *point);
|
int taosDoLinearInterpolation(int32_t type, SPoint *point1, SPoint *point2, SPoint *point);
|
||||||
|
|
||||||
|
|
|
@ -2260,7 +2260,9 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
pRuntimeEnv->vnodeFileInfo.numOfFiles = 0;
|
pRuntimeEnv->vnodeFileInfo.numOfFiles = 0;
|
||||||
free(pRuntimeEnv->vnodeFileInfo.pFileInfo);
|
free(pRuntimeEnv->vnodeFileInfo.pFileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosDestoryInterpoInfo(&pRuntimeEnv->interpoInfo);
|
||||||
|
|
||||||
if (pRuntimeEnv->pInterpoBuf != NULL) {
|
if (pRuntimeEnv->pInterpoBuf != NULL) {
|
||||||
for (int32_t i = 0; i < pRuntimeEnv->pQuery->numOfOutputCols; ++i) {
|
for (int32_t i = 0; i < pRuntimeEnv->pQuery->numOfOutputCols; ++i) {
|
||||||
tfree(pRuntimeEnv->pInterpoBuf[i]);
|
tfree(pRuntimeEnv->pInterpoBuf[i]);
|
||||||
|
@ -7085,7 +7087,6 @@ bool vnodeHasRemainResults(void *handle) {
|
||||||
SQuery * pQuery = pRuntimeEnv->pQuery;
|
SQuery * pQuery = pRuntimeEnv->pQuery;
|
||||||
|
|
||||||
SInterpolationInfo *pInterpoInfo = &pRuntimeEnv->interpoInfo;
|
SInterpolationInfo *pInterpoInfo = &pRuntimeEnv->interpoInfo;
|
||||||
|
|
||||||
if (pQuery->limit.limit > 0 && pQInfo->pointsRead >= pQuery->limit.limit) {
|
if (pQuery->limit.limit > 0 && pQInfo->pointsRead >= pQuery->limit.limit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,18 @@ void taosInitInterpoInfo(SInterpolationInfo* pInterpoInfo, int32_t order, int64_
|
||||||
tfree(pInterpoInfo->prevValues);
|
tfree(pInterpoInfo->prevValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the SInterpolationInfo itself will not be released
|
||||||
|
void taosDestoryInterpoInfo(SInterpolationInfo *pInterpoInfo) {
|
||||||
|
if (pInterpoInfo == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tfree(pInterpoInfo->prevValues);
|
||||||
|
tfree(pInterpoInfo->nextValues);
|
||||||
|
|
||||||
|
tfree(pInterpoInfo->pTags);
|
||||||
|
}
|
||||||
|
|
||||||
void taosInterpoSetStartInfo(SInterpolationInfo* pInterpoInfo, int32_t numOfRawDataInRows, int32_t type) {
|
void taosInterpoSetStartInfo(SInterpolationInfo* pInterpoInfo, int32_t numOfRawDataInRows, int32_t type) {
|
||||||
if (type == TSDB_INTERPO_NONE) {
|
if (type == TSDB_INTERPO_NONE) {
|
||||||
return;
|
return;
|
||||||
|
@ -283,8 +295,8 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
|
|
||||||
int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoType, tFilePage** data,
|
int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoType, tFilePage** data,
|
||||||
int32_t numOfRawDataInRows, int32_t outputRows, int64_t nInterval,
|
int32_t numOfRawDataInRows, int32_t outputRows, int64_t nInterval,
|
||||||
int64_t* pPrimaryKeyArray, tColModel* pModel, char** srcData, int64_t* defaultVal,
|
const int64_t* pPrimaryKeyArray, tColModel* pModel, char** srcData, int64_t* defaultVal,
|
||||||
int32_t* functionIDs, int32_t bufSize) {
|
const int32_t* functionIDs, int32_t bufSize) {
|
||||||
int32_t num = 0;
|
int32_t num = 0;
|
||||||
pInterpoInfo->numOfCurrentInterpo = 0;
|
pInterpoInfo->numOfCurrentInterpo = 0;
|
||||||
|
|
||||||
|
@ -351,6 +363,8 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
|
||||||
for (int i = 1; i < pModel->numOfCols; i++) {
|
for (int i = 1; i < pModel->numOfCols; i++) {
|
||||||
setNull(*prevValues + pModel->colOffset[i], pModel->pFields[i].type, pModel->pFields[i].bytes);
|
setNull(*prevValues + pModel->colOffset[i], pModel->pFields[i].type, pModel->pFields[i].bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("alloc=------------------%p\n", *prevValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign rows to dst buffer
|
// assign rows to dst buffer
|
||||||
|
|
Loading…
Reference in New Issue