From df58c99534329c4851e30f7276fa64512c1a7f47 Mon Sep 17 00:00:00 2001 From: Zoli Somogyi Date: Wed, 28 Feb 2024 15:56:12 +0100 Subject: [PATCH] Disposing/Releasing GPU memory The memory was not disposed when Dispose() was called because ReleaseHandle(); was not called by the base class. --- LLama/Native/SafeLlamaModelHandle.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LLama/Native/SafeLlamaModelHandle.cs b/LLama/Native/SafeLlamaModelHandle.cs index acaee849a..5f2a5ae8a 100644 --- a/LLama/Native/SafeLlamaModelHandle.cs +++ b/LLama/Native/SafeLlamaModelHandle.cs @@ -74,6 +74,13 @@ public string Description /// public int MetadataCount => llama_model_meta_count(this); + /// + public new void Dispose() + { + ReleaseHandle(); + base.Dispose(); + } + /// protected override bool ReleaseHandle() {