我的应用程序泄漏了我可绘制文件夹中没有的随机形状的位图 [英] My app leaks Bitmaps of random shapes that I don't have in my drawable folder
问题描述
我有一个奇怪的内存泄漏问题,我的应用程序不断泄漏Bitmap
对象和其他与之相关的对象,例如VectorDrawables
,AnimationDrawables
我通过Eclipse Memory Analyzer
和Gimp能够恢复泄漏的Bitmap
对象,并发现它们是星形,方形或圆形的随机形状.我的res/drawable
文件夹中没有这些形状.
它们来自哪里,为什么泄漏那么多?
此泄漏发生在我的Samsung Galaxy S7 - Android 7.0
和使用Android 7.0
和6.0的模拟器上.但是,当我在运行Android 4.4.4
这里是指向我的hprof的链接.文件,如果有人仔细看的话: https: //www.dropbox.com/s/e1ry3ny5eb66xk8/out3%20-%20Kopi.hprof?dl=0
内存分析器"中的统治者树"屏幕截图
黄色标记是例如这张图片下面的星星
在我的泄漏中发现星星的位图
而且我的stacktrace不断将这些行吐出来
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
所以这个问题很难调试,花了我整整一周的时间.泄漏是从哪里冒出来的,CanaryLeak
甚至无法检测到它.
我卸载了Android Studio,删除了User
文件夹中AppData下PC中所有剩余的文件夹,并删除了C:/User
和Program files
甚至SDK文件夹下与Android或Android Studio有关的所有其他内容. /p>
使用CCleaner
完全清除寄存器,然后再次下载Android Studio,从Git克隆我的项目,然后再次运行我的应用程序,就在这里!完全没有泄漏.
我敢肯定,这种疯狂的泄漏与您自己的应用无关,而与Android Studio有关或完全与其他有关
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
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
这篇关于我的应用程序泄漏了我可绘制文件夹中没有的随机形状的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!