fix mem leak
This commit is contained in:
parent
3c719da5b5
commit
e95735eea4
|
@ -993,7 +993,7 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
|
||||||
stDebug("stream backend:%p end to do checkpoint at:%s, time cost:%" PRId64 "ms", pHandle, pChkpIdDir,
|
stDebug("stream backend:%p end to do checkpoint at:%s, time cost:%" PRId64 "ms", pHandle, pChkpIdDir,
|
||||||
taosGetTimestampMs() - st);
|
taosGetTimestampMs() - st);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stError("stream backend:%p failed to flush db at:%s", pHandle, pChkpIdDir);
|
stError("stream backend:%p failed to flush db at:%s", pHandle, pChkpIdDir);
|
||||||
}
|
}
|
||||||
// release all ref to cfWrapper;
|
// release all ref to cfWrapper;
|
||||||
|
@ -1467,16 +1467,24 @@ rocksdb_compactionfilter_t* compactFilteFactoryCreateFilter(void* arg, rocksdb_c
|
||||||
|
|
||||||
void destroyRocksdbCfInst(RocksdbCfInst* inst) {
|
void destroyRocksdbCfInst(RocksdbCfInst* inst) {
|
||||||
int cfLen = sizeof(ginitDict) / sizeof(ginitDict[0]);
|
int cfLen = sizeof(ginitDict) / sizeof(ginitDict[0]);
|
||||||
for (int i = 0; i < cfLen; i++) {
|
if (inst->pHandle) {
|
||||||
if (inst->pHandle[i]) rocksdb_column_family_handle_destroy((inst->pHandle)[i]);
|
for (int i = 0; i < cfLen; i++) {
|
||||||
|
if (inst->pHandle[i]) rocksdb_column_family_handle_destroy((inst->pHandle)[i]);
|
||||||
|
}
|
||||||
|
taosMemoryFree(inst->pHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
rocksdb_writeoptions_destroy(inst->wOpt);
|
if (inst->cfOpt) {
|
||||||
inst->wOpt = NULL;
|
for (int i = 0; i < cfLen; i++) {
|
||||||
|
rocksdb_options_destroy(inst->cfOpt[i]);
|
||||||
|
rocksdb_block_based_options_destroy(((RocksdbCfParam*)inst->param)[i].tableOpt);
|
||||||
|
}
|
||||||
|
taosMemoryFreeClear(inst->cfOpt);
|
||||||
|
taosMemoryFreeClear(inst->param);
|
||||||
|
}
|
||||||
|
if (inst->wOpt) rocksdb_writeoptions_destroy(inst->wOpt);
|
||||||
|
if (inst->rOpt) rocksdb_readoptions_destroy(inst->rOpt);
|
||||||
|
|
||||||
rocksdb_readoptions_destroy(inst->rOpt);
|
|
||||||
taosMemoryFree(inst->cfOpt);
|
|
||||||
taosMemoryFreeClear(inst->param);
|
|
||||||
taosMemoryFree(inst);
|
taosMemoryFree(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,6 +1653,12 @@ int streamStateOpenBackend(void* backend, SStreamState* pState) {
|
||||||
pState->pTdbState->backendCfWrapperId = id;
|
pState->pTdbState->backendCfWrapperId = id;
|
||||||
pState->pTdbState->pBackendCfWrapper = pBackendCfWrapper;
|
pState->pTdbState->pBackendCfWrapper = pBackendCfWrapper;
|
||||||
stInfo("succ to open state %p on backendWrapper, %p, %s", pState, pBackendCfWrapper, pBackendCfWrapper->idstr);
|
stInfo("succ to open state %p on backendWrapper, %p, %s", pState, pBackendCfWrapper, pBackendCfWrapper->idstr);
|
||||||
|
|
||||||
|
inst->pHandle = NULL;
|
||||||
|
inst->wOpt = NULL;
|
||||||
|
inst->rOpt = NULL;
|
||||||
|
inst->cfOpt = NULL;
|
||||||
|
inst->param = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
taosThreadMutexUnlock(&handle->cfMutex);
|
taosThreadMutexUnlock(&handle->cfMutex);
|
||||||
|
|
Loading…
Reference in New Issue