whisper.cpp/src
Daniel Bevenius c8223a8548
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 aeafca437e.

* 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.
2025-10-06 14:57:44 +02:00
..
coreml coreml : backport CoreML features to macos < 14 (#3255) 2025-06-24 09:24:27 +02:00
openvino whisper : reorganize source code + improve CMake (#2256) 2024-06-26 19:34:09 +03:00
CMakeLists.txt coreml : backport CoreML features to macos < 14 (#3255) 2025-06-24 09:24:27 +02:00
whisper-arch.h vad : add initial Voice Activity Detection (VAD) support (#3065) 2025-05-12 16:10:11 +02:00
whisper.cpp vad : fix memory leaks in VAD implementation (#3453) 2025-10-06 14:57:44 +02:00