Cali
Cali

Reputation: 21

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.

Upvotes: 0

Views: 1120

Answers (1)

QJGui
QJGui

Reputation: 967

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

Upvotes: 1

Related Questions