greeshmay ggerganov commited on
Commit
06b8aa3
·
unverified ·
1 Parent(s): 1ffa4c8

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

Browse files

* fix: free ggml_context

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

Co-authored-by: Georgi Gerganov <[email protected]>

Files changed (1) hide show
  1. whisper.cpp +6 -0
whisper.cpp CHANGED
@@ -2169,6 +2169,12 @@ struct whisper_context * whisper_init(const char * path_model) {
2169
 
2170
  void whisper_free(struct whisper_context * ctx) {
2171
  if (ctx) {
 
 
 
 
 
 
2172
  if (ctx->buf_model) {
2173
  delete ctx->buf_model;
2174
  }
 
2169
 
2170
  void whisper_free(struct whisper_context * ctx) {
2171
  if (ctx) {
2172
+ if (ctx->model.ctx) {
2173
+ ggml_free(ctx->model.ctx);
2174
+ }
2175
+ if (ctx->model.ctx_mem) {
2176
+ ggml_free(ctx->model.ctx_mem);
2177
+ }
2178
  if (ctx->buf_model) {
2179
  delete ctx->buf_model;
2180
  }