fix the codegen memory leak

This commit is contained in:
gentle_hu
2022-11-10 10:05:22 +08:00
parent 93ad4ac372
commit 8878fec290
3 changed files with 13 additions and 3 deletions

View File

@ -1036,7 +1036,8 @@ void CodeGenThreadInitialize()
bool CodeGenThreadObjectReady()
{
return t_thrd.codegen_cxt.thr_codegen_obj != NULL && !t_thrd.codegen_cxt.g_runningInFmgr;
return t_thrd.codegen_cxt.thr_codegen_obj != NULL && !t_thrd.codegen_cxt.g_runningInFmgr
&& !((dorado::GsCodeGen*)t_thrd.codegen_cxt.thr_codegen_obj)->IsCompiled();
}
/**

View File

@ -787,7 +787,8 @@ void standard_ExecutorEnd(QueryDesc *queryDesc)
UnregisterSnapshot(estate->es_crosscheck_snapshot);
#ifdef ENABLE_LLVM_COMPILE
if (!t_thrd.codegen_cxt.g_runningInFmgr) {
/* Do not release codegen in Fmgr and Procedure */
if (!t_thrd.codegen_cxt.g_runningInFmgr && u_sess->SPI_cxt._connected == -1) {
CodeGenThreadTearDown();
}
#endif
@ -3826,4 +3827,4 @@ TupleTableSlot* FetchPlanSlot(PlanState* subPlanState, ProjectionInfo** projInfo
} else {
return ExecProcNode(subPlanState);
}
}
}

View File

@ -539,6 +539,14 @@ public:
m_currentModule = NULL;
}
/*
* @Description : Get m_moduleCompiled.
*/
inline bool IsCompiled()
{
return m_moduleCompiled;
}
/*
* @Description : IR compile to machine code.
*/