devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

fix memory leak #86

Closed kalgecin closed 1 year ago

kalgecin commented 1 year ago

While profiling my application, i noticed some memory leaks

  1. 960 byte arrays, which was same length passed into AudioSink, fixed in AudioTrackSink
  2. some VideoFrame and NativeI420Buffer were not released, fixed in VideoTrackSink and VideoFrame

From these fixes, my application does not seem to have a memory leak, capable of running for hrs with only 100mb heap, compared to a few minutes before this patch. This is the first time I'm doing anything related to JNI, would like feedback on how viable my solutions are.

kalgecin commented 1 year ago

no more memory leak it seems :) https://github.com/devopvoid/webrtc-java/pull/86/commits/5233d1e5a2abd55379d887591890ffabc13eefa3 fixed the issues with buffers

I'm not sure how "correct" my fix is :P but it works for me. Video stream comes in good and stable

devopvoid commented 1 year ago

Thank you! Sorry for the late response.