]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
fix: free ctx_copy in ggml_opt_free to plug per-training-session leak (llama/21592)
authorRealOrko <redacted>
Wed, 8 Apr 2026 15:40:15 +0000 (16:40 +0100)
committerGeorgi Gerganov <redacted>
Thu, 30 Apr 2026 08:29:03 +0000 (11:29 +0300)
commit16dd1716204773a2f99a29ecf46748fa29d5f2b9
treefcb787d9bf558e898593915681566c73335b9a3c
parente70c0d43f4a8dba5dc0ba7faa387f88d7b41a74c
fix: free ctx_copy in ggml_opt_free to plug per-training-session leak (llama/21592)

* fix: free ctx_copy in ggml_opt_free to plug per-training-session leak

ggml_opt_alloc populates opt_ctx->ctx_copy via a free+init pair every
time the allocated graph shape changes. The last ctx_copy from the
final ggml_opt_alloc call survives until ggml_opt_free is invoked,
but ggml_opt_free was only freeing ctx_static and ctx_cpu, never
ctx_copy. Each opt_ctx lifetime therefore leaks the final per-batch
context — ~900 KB for a typical GNN training session in
sindarin-pkg-tensor, surfaced via AddressSanitizer.

ctx_copy is nullptr-initialized and ggml_free() handles NULL safely,
so the new release is guard-free.

* Update ggml/src/ggml-opt.cpp

Co-authored-by: Johannes Gäßler <redacted>
---------

Co-authored-by: realorko <redacted>
Co-authored-by: Johannes Gäßler <redacted>
ggml/src/ggml-opt.cpp