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

不羁岁月 提交于 2019-12-11 02:06:42

问题


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 ? Any one can explain ? garbage collector in 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.

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 ?

2) As I am beginner, how can I by my self break down how it works (methodology or tools) ?

Any input is appreciated.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/16032438/how-does-garbage-collection-work-in-android-4-2-jelly-bean-dalvik-vm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!