EN 中文
Back to Overview

LiteRtLm_DestroyConversation

Destroys a conversation session. Releases the KV Cache slot occupied by this session in the GPU and cleans up all historical message memory.

01. VRAM Resource Recovery Flow

graph TD Conv[Conversation Handle] -->|Destroy| Pool[VRAM KV Cache Pool] Pool -->|Free Slot| Empty[Available VRAM Slot] Conv -->|Clear| History[RAM History Buffer]

Calling this function is critical to maintaining long-term operational stability. For conversations that are no longer active (e.g., closed UI windows or destroyed NPC Actors), it must be explicitly called to prevent VRAM fragmentation or exhaustion.

02. Parameter Definition

void LiteRtLm_DestroyConversation(void* conv_ptr);
ParameterDescription
conv_ptr The session handle to destroy. After invocation, this pointer and the associated KV Cache will be immediately invalidated.

03. Standard Cleanup Pattern

// End conversation and recover VRAM
if (ActiveConversation) {
    LiteRtLm_DestroyConversation(ActiveConversation);
    ActiveConversation = nullptr;
}