在空应用程序的内存使用情况 [英] Memory usage in empty application

查看:90
本文介绍了在空应用程序的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Android 4.0.3创建一个空的应用程序,当我倾倒堆与HPROF,我看到8,3 MB由应用程序使用的(在我的Nexus S)!

I have created an empty application on Android 4.0.3 and when I dump heap with hprof, I see that 8,3 MB are used by the application (on my Nexus S)!

这是一个空的应用程序非常大。当我分析了内存使用情况,我看到的主要部分(5,6 MB)所使用的android.content.res.Resources类。我不明白为什么需要这么多的内存中,只有小的默认图标(4 KB)和默认布局和字符串的文件(1 KB每个)。它是正常的吗?有你在其他Android版本相同的结果?有人有一个想法,以减少呢?

It is very big for an empty application. When I analyze the memory usage, I see that the main part (5,6 MB) is used by android.content.res.Resources class. I don't understand why it takes so much memory, there is just the small default icon (4 kB) and the default layout and string files (1 kB each). Is it normal ? have you the same result on other Android version ? Somebody has an idea to reduce it ?

推荐答案

如果您在ICS(我假设你是),则是因为硬件加速。
不知道是否它是默认启用的(我不认为这是),我没有任何ICS:(

If you are on ICS (I assume you are), then it's because of hardware acceleration. Not sure if it's enabled by default (I don't think it is), I don't have any ICS :(

硬件加速绘制是不是所有的充满胜利。例如在
  设备的PVR司机一样的Nexus S和Galaxy Nexus的,只需
  在启动一个进程使用OpenGL吃大约8MB的内存。鉴于
  我们的流程开销是2MB左右,这是pretty巨大。这需要RAM
  远离其他的东西,比如后台进程的数量
  可以不停地奔跑,有可能放缓之类的应用程序
  切换。

Hardware accelerated drawing is not all full of win. For example on the PVR drivers of devices like the Nexus S and Galaxy Nexus, simply starting to use OpenGL in a process eats about 8MB of RAM. Given that our process overhead is about 2MB, this is pretty huge. That RAM takes away from other things, such as the number of background processes that can be kept running, potentially slowing down things like app switching.

来源: https://plus.google.com/105051985738280261832/p​​osts/2FXDCz8x93s

编辑:为了减少它,你会需要设置您的构建目标蜂窝状或更低,但你也不能使用硬件加速。你的电话。

To reduce it you'll need to set your build target to honeycomb or lower, but then you can't use hardware acceleration either. Your call.

这篇关于在空应用程序的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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