Skip to content

feat: report native objects that were never disposed - #529

Merged
devopvoid merged 1 commit into
mainfrom
feat/native-leak-detector
Nov 4, 2026
Merged

devopvoid merged 1 commit into
mainfrom
feat/native-leak-detector

Conversation

@devopvoid

Copy link
Copy Markdown
Owner
  • -Dwebrtc.java.leak.detection=true reports wrappers that became unreachable without dispose() or close(), as a warning through Logging. -Dwebrtc.java.leak.trace=true adds the stack of their creation. Nothing is freed automatically.
  • Objects are tracked from the moment native code sets their handle, so natively created wrappers are covered too. Ref-counted objects, views and classes without dispose()/close() are left out, as are the objects of webrtc-media.
  • Turned off, it costs an atomic load per handle set and makes no call into Java.

With -Dwebrtc.java.leak.detection=true, a NativeObject that owns a native object and becomes unreachable without dispose() or close() is reported as a warning through Logging, with where it was created when -Dwebrtc.java.leak.trace=true is set as well. Objects are watched from the moment native code binds their handle and released when it is taken or cleared; views and reference-counted objects are not watched. Off by default, and then nothing calls into Java for it.
@devopvoid
devopvoid merged commit 18bf090 into main Nov 4, 2026
25 of 26 checks passed
@devopvoid
devopvoid deleted the feat/native-leak-detector branch November 4, 2026 21:56
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.

1 participant