问题描述
我在PID上使用showmap命令,但我在报表中看不懂此部分:
I use showmap command on a PID, and I can't understand this part in the report:
16384 3752 689 0 3132 0 620 4 /dev/ashmem/dalvik-LinearAlloc (deleted)
2460 1748 934 0 828 0 920 18 /dev/ashmem/dalvik-aux-structure (deleted)
8192 572 572 0 0 0 572 1 /dev/ashmem/dalvik-bitmap-1 (deleted)
8192 0 0 0 0 0 0 1 /dev/ashmem/dalvik-bitmap-2 (deleted)
4100 312 312 0 0 0 312 1 /dev/ashmem/dalvik-card-table (deleted)
502140 14860 14860 0 0 0 14860 3 /dev/ashmem/dalvik-heap (deleted)
1500 280 280 0 0 0 280 1 /dev/ashmem/dalvik-jit-code-cache (deleted)
174764 0 0 0 0 0 0 1 /dev/ashmem/dalvik-mark-stack (deleted)
22148 22148 2141 0 20452 0 1696 1 /dev/ashmem/dalvik-zygote (deleted)
我要知道dalvik-LinearAlloc,dalvik-aux-structure,dalvik-bitmap-1,dalvik-bitmap-2,dalvik-card-table,dalvik-mark-stack和dalvik-zygote中的数据。
I want to know what data is in the dalvik-LinearAlloc, dalvik-aux-structure, dalvik-bitmap-1, dalvik-bitmap-2, dalvik-card-table, dalvik-mark-stack and dalvik-zygote.
这些ashmem消耗了数百万个字节的内存,我想找到一种缩小这些ashmem大小的措施。
These ashmem cost millions bytes memory, and I want to find a measure to shrink the size of these ashmem.
推荐答案
showmap
正在从一个进程中转储smap数据。 地图描述的是进程内存区域的详细信息。在虚拟内存管理系统中,可以通过 mmap , brk 等系统API获取内存。通过这些API获得虚拟内存地址后,地址和 length 将记录在 smap 中。
showmap
is dumpping the smap data from one process. The smap is describing the process's memory area's detail. In virtual memory manage system, the memory can be gained by the system API such as mmap, brk. After gaining virtual memory address by these APIs, the address and length will be recorded in the smap.
然后列出dalvik相对内存使用的每个部分:
And let's list each section of the dalvik relative memory usage:
- Dalvik堆部分(堆管理,GC)
- dalvik-bitmap-1,dalvik-bitmap-2是Dalvik 堆管理数据结构。在Dalvik中,GC是 marksweep ,并且8位字节的内存将在位图中标记为1位(已用或空闲)。这两个位图将用作活动图(用于标记@运行时),另一个位将用作标记图(用于@ GC时间)。
- dalvik-mark-stack:用于GC标记步骤的使用。标记步骤将迭代位图,因此这是广度优先的搜索,需要堆栈。
- dalvik-card-table:用于Dalvik 并发 GC,在位图标记步骤中,该过程将执行其他任务,这将导致使用内存。这些卡表在第一步标记之后记录了脏的内存。您可以通过搜索标记清除GC来查看详细信息。
- dalvik-heap用于进程内存的使用
- dalvik-zygote是其中的一部分孔堆,将不会在@ GC中使用。所有进程都将共享这些内存,例如框架资源。
- Dalvik Heap section(Heap Management, GC)
- dalvik-bitmap-1, dalvik-bitmap-2 is the Dalvik Heap management data stucture. In Dalvik, the GC is marksweep, and 8 bytes memory will be marked(Used or free) as one bit in the bitmap. These two bitmaps will be used as active map(used for marking @ runtime) and the other will be used as marked map(used @ GC time).
- dalvik-mark-stack: For GC mark step use. The mark step will iterate the bitmap, so this is a Breadth-first search which will need a stack.
- dalvik-card-table: is used for Dalvik Concurrent GC, in bitmap marking steps, the process will do other tasks which will lead using memory. These card tables is recording the memory dirty after first marking step. You can see the detail by searching mark sweep GC.
- dalvik-heap is used for process memory usage
- dalvik-zygote is one part of the hole heap, which will not be used @ GC. All processes will share these memories such as framework resources.
如果您要分析程序的内存,建议您在蚀。还有本机堆的用法,您可以使用mmap进行管理。
If you want to analysis your program's memory, I suggest you to use MAT in eclipse. And the native heap usage, you can use mmap to manage.
这篇关于dalvik-LinearAlloc,dalvik-aux-structure,dalvik-bitmap-1,dalvik-bitmap-2,dalvik-card-table,dalvik-mark-stack和dalvik-zygote中的数据是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!