gpt4 book ai didi

android - 布局的 100mb 内存使用正常吗?

转载 作者:行者123 更新时间:2023-11-29 14:43:58 25 4
gpt4 key购买 nike

我有点担心我的应用程序的内存使用情况。对于以下场景,我创建了一个全新的项目。 MainActivity 只是设置 ContentView。

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

所以...我有一个简单的登录布局enter image description here enter image description here

它的内存使用量接近 100mb!? enter image description here

所有 ImageView 都不包含任何图像。它们只有静态颜色(即浅蓝色)。

但是 100mb 的内存使用量正常吗?还是我错过了什么?感谢您的宝贵时间和帮助!

最佳答案

我觉得很正常。它实际上并没有吃掉 100MB 的 RAM。在新的 Android 监视器上,AS3 数字与以前的 AS2 有点不同。在user guide here , 它是这样写的:

When compared to memory counts from the previous Android Monitor tool, the new Memory Profiler records your memory differently, so it might seem like your memory use is now higher. The Memory Profiler monitors some extra categories that increase the total, but if you only care about the Java heap memory, then the "Java" number should be similar to the value from the previous tool.

And although the Java number probably doesn't exactly match what you saw in Android Monitor, the new number accounts for all physical memory pages that have been allocated to your app's Java heap since it was forked from Zygote. So this provides an accurate representation of how much physical memory your app is actually using.

Currently, the Memory Profiler also shows some false-positive native memory usage in your app that actually belongs to the profiling tools. Up to 10MB of memory is added for ~100k objects. In a future version of the tools, these numbers will be filtered out of your data.

关于android - 布局的 100mb 内存使用正常吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48101941/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com