Android Profiler timeline vs heap dump values 安卓性能分析器时间线与堆转储数值

huangapple go评论60阅读模式
英文:

Android Profiler timeline vs heap dump values

问题

我创建了一个示例应用程序并运行了Android Profiler。在获取Java/Kotlin内存转储之前,我看到了以下这些数字:

然而,在内存转储窗口中,我看到了这些:

查看应用堆
Android Profiler timeline vs heap dump values
安卓性能分析器时间线与堆转储数值

查看所有堆
Android Profiler timeline vs heap dump values
安卓性能分析器时间线与堆转储数值

让我们来看看这些数字:
在转储之前,Native大小为4.6 MB,而在转储中,我看到本地大小等于92,041或91 kB(应用堆),以及505,895或505 kB(所有堆)。它们都与4.6 MB 都不接近。所以我想知道图表中的数字和堆转储中的数字之间有什么关系。

同样,我不明白堆转储中的保留大小值与时间线中的其他、代码、堆栈、图形和Java之间有什么关系。

英文:

I created a sample app and ran the Android Profiler. Just before getting a Java/Kotlin memory dump, I saw these numbers:

Android Profiler timeline vs heap dump values
安卓性能分析器时间线与堆转储数值

However, in the memory dump window I see these:

View App Heap
Android Profiler timeline vs heap dump values
安卓性能分析器时间线与堆转储数值

View All Heaps
Android Profiler timeline vs heap dump values
安卓性能分析器时间线与堆转储数值

Let's take a look at the numbers:
Native equals to 4.6 MB before the dump, and in the dump I see the native size equals to 92,041 or 91 kB (app heap) and 505,895 or 505 kB (all heaps). Neither of them is close to 4.6 MB. So I wonder how the graph numbers and the numbers in the heap dump are related.

Similarly, I don't understand how the retained size values from the dump are related to Others, Code, Stack, Graphics and Java in the timeline.

答案1

得分: 1

以下是翻译好的部分:

这是我的假设。内存概览 文章中提到:
> 当检查您的应用程序的堆时,Android 计算一个称为比例集大小(PSS)的值,该值考虑了与其他进程共享的脏页和干净页,但仅考虑与多少应用程序共享该 RAM 量成比例的部分。

内存计数方式的解释 包括:
> 您在内存分析器(图2)顶部看到的数字基于您的应用程序已承诺的所有私有内存页,根据 Android 系统。这个计数不包括与系统或其他应用程序共享的页面。

因此,我在第一个截图中看到的应用程序堆值 8,372,986(或约 8.3 MB)包括了与其他进程共享的脏页和干净页,而第一个截图中的 5.4 MB Java 内存包括了我的应用程序已经承诺的私有内存页面,根据 Android 系统。这个计数不包括与系统或其他应用程序共享的页面。

英文:

Here is my assumption. The Memory Overview article says:
> When inspecting your app's heap, Android computes a value called the Proportional Set Size (PSS), which accounts for both dirty and clean pages that are shared with other processes—but only in an amount that's proportional to how many apps share that RAM

and the explanation of how memory is counted contains:
> The numbers you see at the top of the Memory Profiler (figure 2) are based on all the private memory pages that your app has committed, according to the Android system. This count does not include pages shared with the system or other apps.

So the app heap value of 8,372,986 (or ~8.3 MB) I saw included both dirty and clean pages that are shared with other processes whereas 5.4 MB of Java memory from the first screenshot includes private memory pages that my app has committed, according to the Android system. This count does not include pages shared with the system or other apps.

huangapple
  • 本文由 发表于 2023年2月27日 19:09:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75579696.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定