diff --git a/gpt4all-backend/replit.cpp b/gpt4all-backend/replit.cpp index 6f7c0a52..71a5cae4 100644 --- a/gpt4all-backend/replit.cpp +++ b/gpt4all-backend/replit.cpp @@ -904,6 +904,11 @@ int32_t Replit::threadCount() const Replit::~Replit() { + #ifdef GGML_USE_METAL + if (d_ptr->model->ctx_metal) { + ggml_metal_free(d_ptr->model->ctx_metal); + } + #endif if(d_ptr->model->ctx) { ggml_free(d_ptr->model->ctx); d_ptr->model->ctx = nullptr;