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.

Sample application, memory leaks found by LeakCanary

See original GitHub issue

Issue Type

[ X] Bug

Description and/or steps/code to reproduce the problem

I was using the demo application and noticed that LinearLayout is leaked when calling a sample and moving back to the ListView. I added screenshots from three different cases below.

Environment

If it’s a bug, version(s) of android this affects:

All

Version of osmdroid the issue relates to:

6.1.5

Screenshot_20191227-105837 Screenshot_20191227-105847 Screenshot_20191227-105909

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
monsieurtanukicommented, Jan 19, 2020

So far so good. The solution seems to be:

  • in all Fragments, the Views must be nulled in onDestroyView (which is already the case in BaseSampleFragment because of an old memory leak issue #335)
  • a good practice seems to call the super statement last in onDestroyView

As there are about 140 Fragments in the demo app, the fix is not going to be instant (though it’s easy). I’m working on it.

0reactions
monsieurtanukicommented, Jan 20, 2020

Life is short: I limited the fix to the main Fragments. If we find fragments related memory leaks, now we now how to deal with them. Fixed by #1487.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Memory Leaks in Android Using LeakCanary
This tutorial will help the reader understand how to use LeakCanary to detect memory leaks in Android applications.
Read more >
Fixing a memory leak - LeakCanary
A memory leak is a programming error that causes an application to keep a reference to an object that is no longer needed....
Read more >
LeakCanary: Detect all memory leaks! - Medium
LeakCanary is an Open Source Java library to detect memory leaks in your debug builds. Let's look at a cat example: class Cat...
Read more >
Finding Memory Leaks with Leak Canary
If memory leaks are detected, Leak Canary builds a notification. You can click on the notification to see more information about the detected...
Read more >
Detect memory leaks in your instrumentation tests using ...
I wrote (stole from the LeakCanary sample app) this Activity which leaks memory when pressing the “Leak” button. The code is in Java...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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