From 8e2e6304057af44e66c0c3a123ca798dc4d25a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=BA?= Date: Thu, 14 Nov 2024 22:04:01 +0800 Subject: [PATCH] fix mem leakage based on leaks tool (still WIP) --- common/common-nexa.cpp | 3 ++- examples/qwen2-audio/whisper.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/common-nexa.cpp b/common/common-nexa.cpp index e8a54ba04..c41f91384 100644 --- a/common/common-nexa.cpp +++ b/common/common-nexa.cpp @@ -150,6 +150,7 @@ bool load_hparams_and_tensors_from_gguf(const std::string &fname, NexaBaseModel } ggml_free(meta); + gguf_free(ctx_gguf); return true; } @@ -314,4 +315,4 @@ struct ggml_tensor * ggml_graph_node(struct ggml_cgraph * cgraph, int i) { GGML_ASSERT(i < cgraph->n_nodes); return cgraph->nodes[i]; -} \ No newline at end of file +} diff --git a/examples/qwen2-audio/whisper.cpp b/examples/qwen2-audio/whisper.cpp index 6da9d268d..b2ce58475 100644 --- a/examples/qwen2-audio/whisper.cpp +++ b/examples/qwen2-audio/whisper.cpp @@ -9467,6 +9467,8 @@ static bool whisper_encoder_load(struct whisper_model_loader *loader, whisper_co wctx.t_load_us = ggml_time_us() - t_start_us; + gguf_free(gguf_ctx); + return true; }