From af692195aaec35cc5f1aeedbe06418befc5a277b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Jul 2026 17:26:06 +0000 Subject: [PATCH] Log a ~10s memory heartbeat during playback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The latest jetsam took a full song of plain playback with zero ingest activity — a window no existing breadcrumb covers. tick() now logs os_proc_available_memory every ~10 s while playing, so the next kill's console shows the decay slope (how fast, from what baseline) instead of silence. --- Packages/ContinuityKit/Sources/Playback/Player.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Packages/ContinuityKit/Sources/Playback/Player.swift b/Packages/ContinuityKit/Sources/Playback/Player.swift index 20db9c8..ed8c1b2 100644 --- a/Packages/ContinuityKit/Sources/Playback/Player.swift +++ b/Packages/ContinuityKit/Sources/Playback/Player.swift @@ -237,6 +237,8 @@ public final class Player { var historyIDs: [UUID] = [] /// Ticks since the last periodic state save (persist every ~5 s while playing). private var ticksSincePersist = 0 + /// Tick counter for the ~10 s playback memory heartbeat. + private var memTicks = 0 // MARK: Internals @@ -320,6 +322,15 @@ public final class Player { guard isPlaying, let audio else { return } let elapsed = baselineSeconds + audio.current.elapsed position = elapsed + // Playback memory heartbeat (~10 s): the jetsam RCA's remaining blind spot is memory + // that ramps during PLAIN playback (no ingest/stems activity, so no other breadcrumb + // fires). The decay slope across these lines names the leak rate; the value at the + // last line before a kill names the floor. Cheap enough to leave in release. + memTicks += 1 + if memTicks >= 200 { + memTicks = 0 + Logger.audio.info("mem[playback] \(os_proc_available_memory() / 1_048_576, privacy: .public) MB headroom") + } // Periodic save (~5 s) so a kill/crash resumes near the right spot next launch. ticksSincePersist += 1 if ticksSincePersist >= 100 {