Java Reference
In-Depth Information
marking process is complete, the collector can reclaim the dead objects
(those which are not marked) by sweeping them away.
Any change to the interconnection of objects during a run of mark-and-
sweep will clearly interfere with the collection process. A marking run
can miss an object that was unreachable at the beginning of the marking
process, but which is assigned to a reachable reference in the middle.
Running a basic mark-and-sweep pass requires freezing execution of the
program, at least during the marking phase.
There are other problems with mark-and-sweep. Garbage collection is a
complex area of research with no easy or universal answers. We present
mark-and-sweep as a relatively simple mental model for you to use to
understand garbage collection. Each virtual machine has its own collec-
tion strategy, and some let you choose among several. Use this mark-
and-sweep model as a mental model onlydo not assume that this is how
any particular virtual machine actually works.
 
Search WWH ::




Custom Search