question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

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:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bomberayacommented, Jun 29, 2022

@HBiSoft could you please check if this PR fixes the issue, thanks!

1reaction
HBiSoftcommented, May 21, 2022

That’s strange. Let me run it on the library itself. Give me some time and I will get back to you.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found