Skip to content

Commit 4f02636

Browse files
authored
server: free sampling contexts on exit (ggml-org#7264)
* server: free sampling contexts on exit This cleans up last leak found by the address sanitizer. * fix whitespace * fix whitespace
1 parent 1265c67 commit 4f02636

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/server/server.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,13 @@ struct server_context {
671671
model = nullptr;
672672
}
673673

674+
// Clear any sampling context
675+
for (server_slot & slot : slots) {
676+
if (slot.ctx_sampling != nullptr) {
677+
llama_sampling_free(slot.ctx_sampling);
678+
}
679+
}
680+
674681
llama_batch_free(batch);
675682
}
676683

0 commit comments

Comments
 (0)