Mark and Sweep Garbage Collection

Mark and Sweep Garbage Collection - Collection Global Vars...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Mark and Sweep Garbage Collection The Garbage Collector determines what objects are reachable from the “roots”, Roots: memory that is not dynamic such as stack, global variables, registers etc. and then frees the unreachable objects. Every object has a bit called the “mark bit” Mark_and_sweep_gc Clear mark bits Push root addresses to mark stack While the stack is not empty
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mark and Sweep Garbage
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Collection Global Vars Stack Register s Mark and Sweep Garbage Collection The program needs to stop all the threads while the GC is taking place. This is done because if the pointers change while the GC is taking place, some reachable objects may be unmarked and can be erroneously collected. Stopping all the threads except the GC thread is called Stop-the-word....
View Full Document

Page1 / 3

Mark and Sweep Garbage Collection - Collection Global Vars...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online