为什么堆大小不断增加? [英] Why does heap size keep increasing?

查看:261
本文介绍了为什么堆大小不断增加?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了很多的涟漪效果和动画的应用程序。

I have an application that has a lot of ripple effects and animations.

我试图来回多个屏幕,并且还垃圾邮件点击按钮。

I tried going back and forth multiple screens, and also spam clicking buttons.

我注意到,堆大小不断上升,尽管有些画面已经被关闭。

I noticed that the heap size continuously goes up even though some screens have already been closed.

当我检查了堆转储,以最高的保留堆是在 android.graphics.Bitmap 类,并指向所有的按钮我点击,有一个类连锁反应。

When I checked the heap dump, the class with the highest Retained heap was the android.graphics.Bitmap class and points to all of the buttons I clicked that has a Ripple Effect.

按钮上的涟漪效应只是简单的涟漪,它使用?ATTR / selectableItemBackgroundBorderless 作为背景。但它上升由0.3MB或0.5MB按钮中的每次点击与涟漪。

The Ripple Effects on the buttons are just simple ripples which uses ?attr/selectableItemBackgroundBorderless as the background. But it goes up by 0.3mb or 0.5mb on every click of the buttons with ripples.

推荐答案

可能是某种形式的MemoryLeak。这几乎是不可能告诉哪里出了问题,而不an​​alise的code。我推荐一些测试。

Could be a MemoryLeak of some kind. It's almost impossible to tell where is the problem without analise the code. I recommend some tests.

您可以尝试泄漏金丝雀库。的lib可以看具体对象,缩小了泄漏搜索。

You could try the Leak Canary library. The lib can "watch" specifics objects and narrow the search for the leak.

这篇关于为什么堆大小不断增加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆