Spaces:
Sleeping
Sleeping
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]>
- 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 |
}
|