devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
264 stars 62 forks source link

fix memory leak #86

Closed kalgecin closed 2 years ago

kalgecin commented 2 years 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 2 years 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 2 years ago

Thank you! Sorry for the late response.