]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
vad : fix memory leaks in VAD implementation (#3453)
authorDaniel Bevenius <redacted>
Mon, 6 Oct 2025 12:57:44 +0000 (14:57 +0200)
committerGitHub <redacted>
Mon, 6 Oct 2025 12:57:44 +0000 (14:57 +0200)
commitc8223a8548ad64435266e551385fc51aca9ee8ab
tree255473d0d7443edd206d29e028940f868b251772
parent7849aff7a2e1f4234aa31b01a1870906d5431959
vad : fix memory leaks in VAD implementation (#3453)

* vad : fix memory leak by storing ggml_context in vad context struct

This commit addresses a memory leak issue in the voice activity
detection (VAD) where the ggml_context is not stored within the vad
context structure.

The motivation for this change that this is causing the context memory
to stay allocated and the tensor still point to that memory but this
memory is never freed.

* vad : free memory allocated for VAD hparams

This commit frees the model hyperparameters allocated for the VAD
context in the `whisper_vad_free` function. Specifically, it deletes the
`encoder_in_channels`, `encoder_out_channels`, and `kernel_sizes` arrays
allocated with `new[]` in the `whisper_vad_init` function.

The motivation for this is to prevent memory leaks when the VAD.

* vad: free ggml buffer in whisper_vad_free

This commit frees the ggml buffer in the whisper_vad_free function to
prevent memory leaks.

Resolves: https://github.com/ggml-org/whisper.cpp/issues/3452

* Revert "vad : fix memory leak by storing ggml_context in vad context struct"

This reverts commit aeafca437efa7fb28166703f845e321176aa62ab.

* whisper : free ggml context in whisper_vad_init_context

This commit frees the ggml_context after initializing the VAD context in
the whisper_vad_init_context function.

The motivation for this is to prevent memory leaks.
src/whisper.cpp