Did you wrote your own garbage colector? Is it a moving one or a not moving one?
1) When a function is finished, all memory related to the scope of that runtime is freed.
2) When an value is not returned out of a statement, or assigned to a variable, said value is freed.
3) When a function is applied, if an argument has no reference (it is not stored in a variable), it is freed.
4) Additionally, if the function itself has no reference (such as in the case of an immediately invoked function), it is freed.
Hope that clarifies things a bit :D
f = {
x = (list 1 2 3)
y = (list x x)
z = (get x 1)
<- y
}
How does the compiler decides if it must free the memory used by x?