简体   繁体   中英

Is Dalvik GC using concurrent mark and sweep or copying or both?

Is this statement correct ? "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" Any one can explain ? garbage collector in android 2.3

Thanks a lot.

As I know, there are two GC modes in the dalvikvm. One is ConcurrentMarkSweep and the other is Copying.

Only one mode will be compiled in the run time.

And the default mode is the concurrent mark sweep GC. The concurrent is only used in gc mark sweep step. And in GC process, the full steps are:

  1. Suspend all other threads
  2. Root mark(thread stacks, jni references, class static fields & class objects)
  3. Resume all threads expect itself
  4. Concurrent mark sweep which is depend on the gc mark-bitmap. Here, the other threads are in the running status
  5. Suspend all other threads
  6. Root mark again
  7. Mark dirty objects by cardtable
  8. Suspend threads
  9. Concurrent sweep

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