Skip to content

Various Cuda/FFI Memory Lifecycle Fixes - #257

Merged
alan-george-lk merged 2 commits into
mainfrom
alan/bugfix-memory-leak-fixes
Sep 8, 2026
Merged

Various Cuda/FFI Memory Lifecycle Fixes#257
alan-george-lk merged 2 commits into
mainfrom
alan/bugfix-memory-leak-fixes

Conversation

@alan-george-lk

Copy link
Copy Markdown
Collaborator

Pulls in livekit-ffi/v0.12.77, fixing the following issues:

  • Room disconnect closes peer connections before signal teardown, so cancelled close can no longer leak ICE UDP sockets
  • Repeated connect/disconnect no longer retains room sessions or data-channel observer cycles
  • Dropping an unused VideoSource now releases its keepalive buffers instead of pinning them for the process lifetime
    NVIDIA encoder/decoder factories tear down a shared CUDA context on last drop, and NVENC init failures no longer leave a half-initialized encoder
  • FFI shutdown drops leftover handles one at a time so nested dispose cannot re-enter handle-map clear
  • PlatformAudio runs all ADM access on the WebRTC worker thread, creates the ADM lazily, and keeps Android recording and shutdown races from dropping audio
  • Linux dmabuf frames are captured through the existing video capture path
  • Publishing pre-encoded video on macOS no longer segfaults

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

🐛 1 issue in files not directly in the diff

🐛 Concurrent shutdown leaks FFI resources

A request storing a handle after dispose snapshots the map escapes cleanup. store_handle does not synchronize with disposal. The resource survives until another shutdown or process exit.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@alan-george-lk
alan-george-lk merged commit 13d92d1 into main Sep 8, 2026
25 checks passed
@alan-george-lk
alan-george-lk deleted the alan/bugfix-memory-leak-fixes branch September 8, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants