summaryrefslogtreecommitdiff
path: root/examples/server
diff options
context:
space:
mode:
authorSteve Grubb <ausearch.1@gmail.com>2024-05-14 10:11:24 -0400
committerGitHub <noreply@github.com>2024-05-14 16:11:24 +0200
commit4f0263633b40e94e8b69fd6e7e4395cfedfd5c12 (patch)
treea1ca335c48429bc826b591fd4529d76f7207133e /examples/server
parent1265c670fd8e41e1947352c96c5179adda97fb2c (diff)
server: free sampling contexts on exit (#7264)
* server: free sampling contexts on exit This cleans up last leak found by the address sanitizer. * fix whitespace * fix whitespace
Diffstat (limited to 'examples/server')
-rw-r--r--examples/server/server.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
index ceaeb1f7..7e0d068f 100644
--- a/examples/server/server.cpp
+++ b/examples/server/server.cpp
@@ -671,6 +671,13 @@ struct server_context {
model = nullptr;
}
+ // Clear any sampling context
+ for (server_slot & slot : slots) {
+ if (slot.ctx_sampling != nullptr) {
+ llama_sampling_free(slot.ctx_sampling);
+ }
+ }
+
llama_batch_free(batch);
}