How the Nasal GC works: Difference between revisions

m
m (no more WIP at the moment)
Line 44: Line 44:
The mark-and-sweep algorithm consists of two phases: In the first phase, it finds and marks all accessible objects. The first phase is called the mark phase. In the second phase, the garbage collection algorithm scans through the heap and reclaims all the unmarked objects. The second phase is called the sweep phase.
The mark-and-sweep algorithm consists of two phases: In the first phase, it finds and marks all accessible objects. The first phase is called the mark phase. In the second phase, the garbage collection algorithm scans through the heap and reclaims all the unmarked objects. The second phase is called the sweep phase.


The mark/sweep algorithm can also be easily expressed using pseudo code, i.e. in Nasal tself:
The mark/sweep algorithm can also be easily expressed using pseudo code, i.e. in Nasal itself:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
136

edits