0

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.

Community
  • 1
  • 1
Cali
  • 21
  • 4
  • http://www.brpreiss.com/books/opus5/html/page424.html. Gc doesmark and sweep – Raghunandan Jun 19 '13 at 12:45
  • https://www.youtube.com/watch?v=_CruQY55HOk&noredirect=1. check this video might help. – Raghunandan Jun 19 '13 at 12:54
  • http://stackoverflow.com/questions/16032438/how-does-garbage-collection-work-in-android-4-2-jelly-bean-dalvik-vm/16047212#16047212 – fadden Jun 19 '13 at 16:02
  • Duplicate of questions http://stackoverflow.com/q/14840637/772000 and http://stackoverflow.com/q/16032438/772000 – Aleš Jun 19 '13 at 17:09

1 Answers1

1

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
QJGui
  • 907
  • 8
  • 10