Engine destructor. Thoroughly releases GPU buffers, model weight memory, and associated thread pools. Ensures no memory dead zones are left behind.
void LiteRtLm_DestroyEngine(void* engine_ptr);
| Parameter | Description |
|---|---|
engine_ptr |
The engine handle to destroy. After invocation, this pointer is no longer usable. |
In Unreal Engine, it is recommended to call this interface during the EndPlay or BeginDestroy phase. Since it involves mandatory synchronous recovery of GPU resources, execution on a non-game thread is advised.
// UE5 Subsystem Cleanup Example
void UMyAiSubsystem::Deinitialize() {
if (EngineHandle) {
LiteRtLm_DestroyEngine(EngineHandle);
EngineHandle = nullptr;
}
Super::Deinitialize();
}