go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

Fix memory leaks in HLS sessions, WriteBuffer, and RTSP UDP handling

Open matteius opened this issue 3 weeks ago • 0 comments

  • Add MaxSessions limit (100) to prevent HLS session accumulation
  • Add session cleanup goroutine with 30-second monitoring interval
  • Add MaxBufferSize (16MB) limit to HLS session buffers
  • Add MaxWriteBufferSize (8MB) limit to WriteBuffer
  • Add sync.Pool for UDP read buffers in RTSP conn to reduce allocations
  • Add debug logging for session creation/expiration

These fixes address memory growth issues observed during extended operation where go2rtc memory would grow from ~150MB to 7GB+ over 2.5 days with usage from lightNVR.

matteius avatar Dec 13 '25 15:12 matteius