My app leaks Bitmaps of random shapes that I don't have in my drawable folder

五迷三道 提交于 2019-12-23 15:51:34

问题


I have a strange memory leak problem where my app keeps leaking Bitmap objects and other objects related like VectorDrawables, AnimationDrawables

I have via Eclipse Memory Analyzer and Gimp been able to recover the leaked Bitmap objects and found out that they are random shapes of stars, and squars or circles. I dont have any of these shapes in my res/drawable folders.

Where do they come from and why are they leaking so much? This leak happend on my Samsung Galaxy S7 - Android 7.0 and on emulator with Android 7.0 and 6.0. But there are no leaks when I run my app on a Huawai running Android 4.4.4

Here is a link to my hprof. file if someone would take a closer look: https://www.dropbox.com/s/e1ry3ny5eb66xk8/out3%20-%20Kopi.hprof?dl=0

Screenshot of the Dominator Tree from the Memory Analyzer

They yellow marked is forexample the stars below this picture

Bitmap of stars found in my leaks

Also my stacktrace keeps spitting these lines out endlessly

 03-21 17:00:08.415 16747-16747/muddzdev.shoppist I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
    03-21 17:00:08.428 16747-16760/muddzdev.shoppist D/InputTransport: Input channel constructed: fd=98
    03-21 17:00:13.315 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:13.632 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:13.914 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:14.257 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:14.592 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:14.933 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled
    03-21 17:00:15.299 16747-16886/muddzdev.shoppist E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled

回答1:


I had the same issue with the S7 after updating to API 24, I was able to remove this error by disabling the GPU monitor in Android Studio. Looks like it definitely is an android studio issue, perhaps only with the S7.




回答2:


So this problem is so hard to debug and it took me a whole weeks work on it. This leak came out of no where and CanaryLeak can't even detect it.

I uninstalled Android Studio, deleted all remaning folders in the pc that is under AppData in your User folder and everything else related to Android or Android Studio under your C:/User and Program files and even the SDK folder.

Made a full clean up of the register with CCleaner and then downloaded Android Studio again, cloned my project from Git and then I ran my app again and here it was! NO LEAKS AT ALL.

I'm pretty sure that this crazy leak has nothing to do with your own app but something with Android Studio or something completely else



来源:https://stackoverflow.com/questions/42937985/my-app-leaks-bitmaps-of-random-shapes-that-i-dont-have-in-my-drawable-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!