llama : fix llama_model_loader memory leak

This commit is contained in:
Georgi Gerganov 2023-08-17 19:49:02 +03:00
parent dd9e2fc988
commit 81a2c2a6f4
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -1083,6 +1083,15 @@ struct llama_model_loader {
this->use_mmap = use_mmap; 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 { const char * get_tensor_name(int i) const {
return gguf_get_tensor_name(ctx_gguf, i); return gguf_get_tensor_name(ctx_gguf, i);
} }