From 81a2c2a6f4ae2a6a89a0456b5b405c426f59db75 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 17 Aug 2023 19:49:02 +0300 Subject: [PATCH] llama : fix llama_model_loader memory leak --- llama.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llama.cpp b/llama.cpp index 018f52e71..753d130d6 100644 --- a/llama.cpp +++ b/llama.cpp @@ -1083,6 +1083,15 @@ struct llama_model_loader { this->use_mmap = use_mmap; } + ~llama_model_loader() { + if (ctx_gguf) { + gguf_free(ctx_gguf); + } + if (ctx_meta) { + ggml_free(ctx_meta); + } + } + const char * get_tensor_name(int i) const { return gguf_get_tensor_name(ctx_gguf, i); }