!2409 修复codegen下游标fetch的内存泄漏。

Merge pull request !2409 from 胡正超/codegen
This commit is contained in:
opengauss-bot
2022-11-17 02:55:57 +00:00
committed by Gitee
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.
*/