mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 00:37:35 +02:00
WIP
This commit is contained in:
parent
3edcf419a9
commit
af8c49d96a
1 changed files with 6 additions and 6 deletions
|
@ -158,27 +158,27 @@ The collector will update its status variable and then wait for all of the colle
|
||||||
During a GC cycle the collector thread transitions through the following states:
|
During a GC cycle the collector thread transitions through the following states:
|
||||||
|
|
||||||
### Clear
|
### Clear
|
||||||
The collector swaps the values of the clear color (white) and the mark color (black). This is more efficient than modifying the color on each object in the heap. The collector then transitions to sync 1.
|
The collector swaps the values of the clear color (white) and the mark color (black). This is more efficient than modifying the color on each object in the heap. The collector then transitions to sync 1. At this point no heap objects are marked, as demonstrated below:
|
||||||
|
|
||||||
<img src="images/gc-graph-clear.png" alt="Initial object graph">
|
<img src="images/gc-graph-clear.png" alt="Initial object graph">
|
||||||
|
|
||||||
### Mark
|
### Mark
|
||||||
The collector transitions to sync 2 and then async. At this point it marks the global variables and waits for the mutators to also transition to async.
|
The collector transitions to sync 2 and then async. At this point it marks the global variables and waits for the mutators to also transition to async:
|
||||||
|
|
||||||
<img src="images/gc-graph-mark.png" alt="Initial object graph">
|
<img src="images/gc-graph-mark.png" alt="Initial object graph">
|
||||||
|
|
||||||
### Trace
|
### Trace
|
||||||
The collector finds all live objects using a breadth-first search and marks them black.
|
The collector finds all live objects using a breadth-first search and marks them black:
|
||||||
|
|
||||||
<img src="images/gc-graph-trace.png" alt="Initial object graph">
|
<img src="images/gc-graph-trace.png" alt="Initial object graph">
|
||||||
|
|
||||||
### Sweep
|
### Sweep
|
||||||
The collector scans the heap and frees memory used by all white objects. If the heap is still low on memory at this point the heap will be increased in size.
|
The collector scans the heap and frees memory used by all white objects:
|
||||||
|
|
||||||
Also, to ensure a complete collection data for any terminated threads is not freed until now.
|
|
||||||
|
|
||||||
<img src="images/gc-graph-sweep.png" alt="Initial object graph">
|
<img src="images/gc-graph-sweep.png" alt="Initial object graph">
|
||||||
|
|
||||||
|
If the heap is still low on memory at this point the heap will be increased in size. Also, to ensure a complete collection data for any terminated threads is not freed until now.
|
||||||
|
|
||||||
### Resting
|
### Resting
|
||||||
The collector cycle is complete and it rests until it is triggered again.
|
The collector cycle is complete and it rests until it is triggered again.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue