Skip to content

Commit

Permalink
fix: release resources in destructor (#179)
Browse files Browse the repository at this point in the history
Co-authored-by: vansangpfiev <[email protected]>
  • Loading branch information
vansangpfiev and sangjanai authored Aug 7, 2024
1 parent ee12d64 commit bfd766b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/llama_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ LlamaEngine::LlamaEngine() {
log_disable();
}

LlamaEngine::~LlamaEngine() {}
LlamaEngine::~LlamaEngine() {
for(auto& [_, si]: server_map_) {
auto& l = si.ctx;
l.ReleaseResources();
}
server_map_.clear();
}

void LlamaEngine::HandleChatCompletion(
std::shared_ptr<Json::Value> json_body,
Expand Down

0 comments on commit bfd766b

Please sign in to comment.