简体   繁体   English

垃圾收集如何在Android 4.2 Jelly bean Dalvik VM中工作?

[英]How does garbage collection work in Android 4.2 Jelly bean Dalvik VM?

Edit : Is this statement "So in android 2.3 concurrent mark and sweep is used for stack related objects treating everything as pointer and copying garbage collection is used for the objects in the heap" correct ? 编辑:这句话是“所以在android 2.3并发标记和扫描用于堆栈相关对象处理一切作为指针和复制垃圾收集用于堆中的对象”正确吗? Any one can explain ? 谁能解释一下? garbage collector in android 2.3 Android 2.3中的垃圾收集器

I know the subject of Garbage Collection in Android has been discussed, but I can't find a clear and detailed explanation of how it works and specially in the last version of Android which is Jelly Bean 4.2 . 我知道Android垃圾收集的主题已经讨论过了,但是我找不到关于它是如何工作的清晰而详细的解释,特别是在最后一个版本的Jelly Bean 4.2中

In addition to the main question I have two more specific questions : 除了主要问题,我还有两个更具体的问题:

1) Which algorithms (Mark and Sweep, Concurrent Mark and Sweep, Copying, generational, incremental..) are implemented and how have they been adapted to actual Android/Dalvik ? 1)算法 (标记和清除,并发标记和清除,复制,辈分,增量..) 实现 ,以及如何拥有他们适应了实际的Android / Dalvik的

2) As I am beginner, how can I by my self break down how it works (methodology or tools) ? 2)作为新手,我如何才能自行分解其工作方式 (方法或工具)?

Any input is appreciated. 任何输入都表示赞赏。

Dalvik's garbage collector hasn't changed significantly since Gingerbread (2.3), so any information you can find of that era or newer will likely apply to Jellybean. 自Gingerbread(2.3)以来,Dalvik的垃圾收集器没有发生重大变化,因此您可以找到那个时代或更新的任何信息都可能适用于Jellybean。

It uses a concurrent mark-and-sweep approach. 它使用并发标记扫掠方法。 It doesn't copy or compact, and has a slight notion of generations (optimizations for memory allocated by the zygote). 它不会复制或压缩,并且具有几代的概念(由合子分配的内存优化)。

The best way to understand how it works is to read the sources. 理解其工作方式的最佳方法是阅读源代码。 Most of the relevant code lives in dalvik/vm/alloc . 大多数相关代码都存在于dalvik/vm/alloc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM