go2rtc
go2rtc copied to clipboard
Fix memory leaks in HLS sessions, WriteBuffer, and RTSP UDP handling
- 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.