Repository navigation
Closed
Labels
bugSomething isn't working
Description
What happened?
Playing a long running live TV session on a host app (Sodalite) results in the app being terminated due to memory pressure (JetsamEvent).
Looking at the logs you can observe a sizeable memory leak on the heap.
I have a forked fix that wraps the demux, reader, feeder, pumpAudio loops in an autoreleasepool on each iteration. This resolves the issue.
I can raise a PR if that would be helpful?
Steps to reproduce
- Open a live tv software playback session
- Observe host app termination (after 30m-1 hour or so).
AetherEngine version or commit SHA
5.20.2
Host app
Sodalite
Platform
tvOS
OS version
tvOS 26.5
Device / chip
Apple TV 4K (3rd Gen)
Playback path
Software (dav1d) host
Source media (for playback bugs)
Live TV
Error codes / log lines
[AetherEngine] memprobe t=30s rss=267MB vmInt=126MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=178MB mallocBlocks=477114 mallocMB=228 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=30s rss=267MB vmInt=126MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=178MB mallocBlocks=477114 mallocMB=228 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=60s rss=285MB vmInt=138MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=190MB mallocBlocks=613559 mallocMB=261 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=60s rss=285MB vmInt=138MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=190MB mallocBlocks=613559 mallocMB=261 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=90s rss=306MB vmInt=154MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=205MB mallocBlocks=747051 mallocMB=305 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=90s rss=306MB vmInt=154MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=205MB mallocBlocks=747051 mallocMB=305 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=120s rss=323MB vmInt=167MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=218MB mallocBlocks=888864 mallocMB=339 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=120s rss=323MB vmInt=167MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=218MB mallocBlocks=888864 mallocMB=339 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=150s rss=343MB vmInt=180MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=232MB mallocBlocks=1011562 mallocMB=375 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
[AetherEngine] memprobe t=150s rss=343MB vmInt=180MB vmExt=105MB vmCmp=0MB vmIOS=0MB physFP=232MB mallocBlocks=1011562 mallocMB=375 avioFetchedMB=0 cacheCount=0 cacheMB=0 packetsWritten=0 audioFifo=0 abFifoKB=0 abSwrKB=0 abTotKB=0 muxBytesMB=0 muxCuts=0 srvConns=0 srvBytesMB=0 srvSfMB=0 pktAlive=0 pktTotal=0 subCues=0 audioTracks=1 subTracks=1 subActive=false avBufAhead=0.0s avBufBehind=0.0s frameAhead=0.00s prodShift=0.00s hostShift=0.00s seams=0
Anything else
The root cause of these leaks seems to be long running (looping) GCD workloads, as the pool is drained on completion (vs structured concurrency where pools are drained on suspension).
Reacted by Enoch Abiodun
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
superuser404notfound commentedon Jul 24, 2026
Great analysis, and yes, a PR would be very welcome. Thanks for digging this deep before reporting.
Your diagnosis matches what the probes say. Everything the engine tracks itself (packet ring, caches, audio FIFO) stays flat in your memprobe lines while mallocBlocks grows linearly, so the growth is untracked small allocations. Each of the SW host loops runs inside a single GCD work item that never returns for the lifetime of the session, so the thread's autorelease pool is never drained, and every ObjC/CF temporary from the per-iteration calls accumulates (the isReadyForMoreMediaData back-pressure polling, renderer/audio enqueue, the NSCondition.wait(until: Date(...)) date bridging, log formatting). The engine already drains per emitted frame inside SoftwareVideoDecoder for exactly this reason; the loops themselves were never wrapped.
Two asks for the PR:
The music path (AudioPlaybackHost.runDemuxLoop) has the same loop shape. Feel free to include it if you want; otherwise I will sweep it in a follow-up.
fix(sw): drain the background audio-only pacing gate per spin (#205)
superuser404notfound commentedon Jul 25, 2026
Released in 5.20.8. Both downstream apps are already pinned to it.
Thanks again for the depth of this one, @nathanpiper. The memprobe pair you attached is what made it a one-pass fix instead of a guess.
diag(memory): census live malloc blocks by size class (superuser404no…