summaryrefslogtreecommitdiff
path: root/docs/type_system/gc.md
blob: 3fcf88efeee39ab4b7de30e27504f7153b20f82e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Gc

---

Hold multiple references to the same object

```text
Gc[Type; GC_FLAGS]
```

# Alias

```text
Shared[Generic.T] `alias Gc[Generic.T; GC_FLAGS]
```

## `GC_FLAGS`

### Lock Mutex

The shared type has been detected across asynchronous tasks and needs to lock the mutex on mutation

# Garbage Collection

A tracing mark and sweep garbage collector is used

# Mutating

```text
x : Shared[Array] $ (1; 2; 3)
^ x {[y]
    y `push 4
}
`log x // Shared[Array[I64]] $ (1; 2; 3; 4)
```