Skip to content

Conversation

danbev
Copy link
Member

@danbev danbev commented Oct 4, 2025

This pull request contains three commit that address memory issues in the VAD implementation.

Resolves: #3452

danbev added 3 commits October 4, 2025 08:51
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.

Resolves: ggml-org#3452
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.

Resolves: ggml-org#3452
This commit frees the ggml buffer in the whisper_vad_free function to
prevent memory leaks.

Resolves: ggml-org#3452
danbev added 2 commits October 6, 2025 12:35
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.
Move ggml_free(ctx) to before returns to avoid memory leaks.
@danbev danbev merged commit c8223a8 into ggml-org:master Oct 6, 2025
66 checks passed
@ggerganov ggerganov deleted the vad-memory-issues branch October 6, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Small memory leaks when using VAD API (whisper_vad_init_with_params / whisper_vad_free)
2 participants