英文:
Android Profiler timeline vs heap dump values
问题
我创建了一个示例应用程序并运行了Android Profiler。在获取Java/Kotlin内存转储之前,我看到了以下这些数字:
然而,在内存转储窗口中,我看到了这些:
让我们来看看这些数字:
在转储之前,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:
However, in the memory dump window I see these:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论