简体   繁体   中英

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 ? 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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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