]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: free sampling contexts on exit (#7264)
authorSteve Grubb <redacted>
Tue, 14 May 2024 14:11:24 +0000 (10:11 -0400)
committerGitHub <redacted>
Tue, 14 May 2024 14:11:24 +0000 (16:11 +0200)
* server: free sampling contexts on exit

This cleans up last leak found by the address sanitizer.

* fix whitespace

* fix whitespace

examples/server/server.cpp

index ceaeb1f76dc3dec4cc1321dc0dc858663f2bbb16..7e0d068f830abb2659d7696f8d89e663eec85365 100644 (file)
@@ -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);
     }