[PR #15030] [CLOSED] fix: close sqlite connection on app shutdown to prevent memory leak #40849

Closed
opened 2026-04-23 01:38:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15030
Author: @BillionClaw
Created: 3/24/2026
Status: Closed

Base: mainHead: clawoss/fix/sqlite-memory-leak-15021


📝 Commits (1)

  • 1579a21 fix: close sqlite connection on app shutdown to prevent memory leak

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 app/cmd/app/app.go (+4 -0)

📄 Description

When the Ollama desktop app shuts down, the sqlite database connection was never closed, causing WAL journal files and deleted data pages to not be reclaimed, leading to db.sqlite file size bloat on Windows (ollama/ollama#15021). This fix adds appStore.Close() to the shutdown sequence after the ollama server goroutine exits, ensuring WAL checkpoint runs and the connection is properly closed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15030 **Author:** [@BillionClaw](https://github.com/BillionClaw) **Created:** 3/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `clawoss/fix/sqlite-memory-leak-15021` --- ### 📝 Commits (1) - [`1579a21`](https://github.com/ollama/ollama/commit/1579a21117d92fe2c0aaf3d1819a25643da2975b) fix: close sqlite connection on app shutdown to prevent memory leak ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/cmd/app/app.go` (+4 -0) </details> ### 📄 Description When the Ollama desktop app shuts down, the sqlite database connection was never closed, causing WAL journal files and deleted data pages to not be reclaimed, leading to db.sqlite file size bloat on Windows (ollama/ollama#15021). This fix adds appStore.Close() to the shutdown sequence after the ollama server goroutine exits, ensuring WAL checkpoint runs and the connection is properly closed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:38:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#40849