Closed sofronovicnikola closed 2 years ago
Is your application in the foreground when stopping the recording?
Yes
That's strange. Let me run it on the library itself. Give me some time and I will get back to you.
Any updates? Thanks.
@sofronovicnikola My apologies for the late reply.
I was able to see the leak, however, I don't know how and why it is happening. I saw this answer, which eliminates this leak, but then I get the following leak:
┬───
│ GC Root: Global variable in native code
│
├─ android.hardware.display.DisplayManagerGlobal$VirtualDisplayCallback instance
│ Leaking: UNKNOWN
│ Retaining 12,9 kB in 60 objects
│ ↓ DisplayManagerGlobal$VirtualDisplayCallback.mDelegate
│ ~~~~~~~~~
├─ android.hardware.display.DisplayManagerGlobal$VirtualDisplayCallbackDelegate
│ instance
│ Leaking: UNKNOWN
│ Retaining 12,3 kB in 59 objects
│ ↓ DisplayManagerGlobal$VirtualDisplayCallbackDelegate.mCallback
│ ~~~~~~~~~
├─ com.hbisoft.hbrecorder.ScreenRecordService$3 instance
│ Leaking: UNKNOWN
│ Retaining 12,3 kB in 58 objects
│ Anonymous subclass of android.hardware.display.VirtualDisplay$Callback
│ this$0 instance of com.hbisoft.hbrecorder.ScreenRecordService
│ ↓ ScreenRecordService$3.this$0
│ ~~~~~~
╰→ com.hbisoft.hbrecorder.ScreenRecordService instance
Leaking: YES (ObjectWatcher was watching this because com.hbisoft.
hbrecorder.ScreenRecordService received Service#onDestroy() callback and
Service not held by ActivityThread)
Retaining 12,3 kB in 57 objects
key = f033983a-70f2-41e7-95c3-63373719a6a0
watchDurationMillis = 54328
retainedDurationMillis = 49324
mApplication instance of android.app.Application
mBase instance of android.app.ContextImpl
The problem seems to come from here
I have no idea how to resolve this, but I will keep doing research. You are more than welcome to download the project and try and figure it out as well.
This issue has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed if no further activity occurs within the next 3 days. Thank you for your contributions.
@HBiSoft could you please check if this PR fixes the issue, thanks!
Describe the bug Facing OutOfMemory exceptions due to memory leaks coming from your library. Memory leaks are being detected after
hbRecorder.stopScreenRecording()
is called.Log Logs are from LeakCanary.
0 APPLICATION LEAKS
HBRecorder version 2.0.4
Device information