dualfroz 3461e6bce4 fix: stop prepared statement cache cleanup goroutine on Close
The expirable LRU cache backing the prepared statement store starts a
background deleteExpired goroutine when it is created with a non-zero TTL.
Its Close method was commented out, so the goroutine kept running for the
lifetime of the process and leaked every time a PreparedStmtDB was
discarded (for example when a *sql.DB is closed and reopened), causing
steady goroutine and memory growth in long-running services.

Expose LRU.Close, add Close to the stmt_store.Store interface and its
lruStore implementation, and call it from PreparedStmtDB.Close so the
background cleanup goroutine is stopped together with the cached
statements. Close is idempotent and safe for concurrent use.

Refs #7788
2026-09-02 11:03:59 +02:00
S
Description
My contributions to go-gorm/gorm: 1 commits
48 KiB
0 Stars 1 Watchers 0 Forks
Languages
Go 100%