Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(engine): evict Ollama's loaded models before a built-in engine start

purplebdfe03c406d7
diff --git a/src-tauri/src/commands/engine.rs b/src-tauri/src/commands/engine.rs
index 58fe4f2e..d9c2f536 100644
--- a/src-tauri/src/commands/engine.rs
+++ b/src-tauri/src/commands/engine.rs
@@ -431,6 +431,15 @@ fn start_bundled_engine_blocking(
println!("[Engine] asked ComfyUI to free VRAM before engine start");
}
+ // Ollama fights for the same VRAM and, unlike ComfyUI, its freshly-used
+ // pages are hot enough that WDDM won't demote them: on a 12 GB 3060 with a
+ // just-active 14B loaded, this engine's own load crawled through paging and
+ // blew the health budget (live repro 2026-07-31; an IDLE model gets evicted
+ // fine). Evict via keep_alive:0 — Ollama reloads lazily on its next use.
+ if crate::commands::process::offload_ollama_loaded_models() {
+ println!("[Engine] asked Ollama to evict loaded models before engine start");
+ }
+
let binary = resolve_engine_binary(app).ok_or_else(|| {
format!(
"Bundled engine binary not found ({}). Run scripts/build-llama.sh to produce the sidecar.",
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 6631722d..b36815b0 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -2134,7 +2134,7 @@ fn offload_local_models_blocking(state: &AppState, include_comfyui: Option<bool>
/// Evict every model Ollama currently holds in memory via `keep_alive: 0`,
/// leaving `ollama serve` running (idle serve is cheap). Best-effort.
-fn offload_ollama_loaded_models() -> bool {
+pub(crate) fn offload_ollama_loaded_models() -> bool {
let client = match reqwest::blocking::Client::builder()
.timeout(std::time::Duration::from_secs(2))
.build()