fix: free ggml_context (close #149) (#150)

* fix: free ggml_context

* ggml : free the model's contexts in whisper_free()

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
pull/160/head
greeshmay 2 years ago committed by GitHub
parent e70e5c8b53
commit 2ba66360c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2169,6 +2169,12 @@ struct whisper_context * whisper_init(const char * path_model) {
void whisper_free(struct whisper_context * ctx) {
if (ctx) {
if (ctx->model.ctx) {
ggml_free(ctx->model.ctx);
}
if (ctx->model.ctx_mem) {
ggml_free(ctx->model.ctx_mem);
}
if (ctx->buf_model) {
delete ctx->buf_model;
}

Loading…
Cancel
Save