Memory Leak
See original GitHub issueDescribe 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
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
====================================
1 LIBRARY LEAKS
A Library Leak is a leak caused by a known bug in 3rd party code that you do not have control over.
See https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/#4-categorizing-leaks
Leak pattern: instance field android.media.projection.MediaProjection$MediaProjectionCallback#this$0
Description: MediaProjectionCallback is held by another process, and holds on to MediaProjection
which has an activity as its context.
363868 bytes retained by leaking objects
Signature: cf05e5fc38dfaf3690c402eff8a119e02748944c
β¬βββ
β GC Root: Global variable in native code
β
ββ android.media.projection.MediaProjection$MediaProjectionCallback instance
β Leaking: UNKNOWN
β Retaining 364.7 kB in 6596 objects
β Library leak match: instance field android.media.projection.MediaProjection$MediaProjectionCallback#this$0
β β MediaProjection$MediaProjectionCallback.this$0
β ~~~~~~
ββ android.media.projection.MediaProjection instance
β Leaking: UNKNOWN
β Retaining 364.7 kB in 6595 objects
β mContext instance of android.app.ContextImpl
β β MediaProjection.mContext
β ~~~~~~~~
ββ android.app.ContextImpl instance
β Leaking: UNKNOWN
β Retaining 364.6 kB in 6589 objects
β mOuterContext instance of com.hbisoft.hbrecorder.ScreenRecordService
β ContextImpl.mOuterContext is an instance of com.hbisoft.hbrecorder.ScreenRecordService
β β ContextImpl.mOuterContext
β ~~~~~~~~~~~~~
β°β 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 363.9 kB in 6573 objects
β key = 8d4c40b7-3c66-4f9a-a8d9-f9c154d6e4af
β watchDurationMillis = 45140
β retainedDurationMillis = 40131
HBRecorder version 2.0.4
Device information
- Motorola G5
- SDK Version 24
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Memory leak - Wikipedia
In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in...
Read more >What is Memory Leak? How can we avoid? - GeeksforGeeks
Memory leak occurs when programmers create a memory in heap and forget to delete it. The consequences of memory leak is that it...
Read more >Definition of memory leak - PCMag
When memory is allocated, but not deallocated, a memory leak occurs (the memory has leaked out of the computer). If too many memory...
Read more >Memory Leaks and Garbage Collection | Computerworld
DEFINITION A memory leak is the gradual deterioration of system performance that occurs over time as the result of the fragmentation of a...
Read more >Memory leak - OWASP Foundation
A memory leak is an unintentional form of memory consumption whereby the developer fails to free an allocated block of memory when no...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@HBiSoft could you please check if this PR fixes the issue, thanks!
Thatβs strange. Let me run it on the library itself. Give me some time and I will get back to you.