mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
Add a dedicated leak_tests binary (separate target because it installs a counting #[global_allocator]) that models a server creating and dropping many databases: repeated open/workload/drop cycles in one process — a fresh database file each cycle — in both WAL and MVCC journal modes, failing if the heap grows beyond a computed budget. The budget pre-computes accepted retention: the database registry keeps a dead entry (whose Weak pins the Database allocation) per unique file identity, sized via size_of::<Database>() so struct growth doesn't require retuning; MVCC is granted two entries per cycle. crossbeam-epoch garbage from the MVCC skiplists is drained before measuring so deferred reclamation is not mistaken for a leak. The completion-group leak blows through this budget on every platform. Also add a reference-retention regression test: after dropping every handle to an MVCC database, Weak handles to the Database and MvStore must fail to upgrade. The leak tests run in the workspace nextest job and as an explicit named step in the Rust workflow. https://claude.ai/code/session_0171ou6qAsxxvCtaWDKFk9sK