@woggioni The GC is involved in your example because the `proc(): auto = pt` is a closure; it captures `pt` as part of its environment.
Closures in Nim are bound to the thread that creates them because the closure's environment is allocated on the thread-local heap (managed by the thread's GC). The local variable `pt` which has a value type (not ref/ptr) would normally be stack-allocated (or even register-allocated) but because it is captured by the closure, it gets directly allocated on the heap in the closure's environment instead. @mashingan FYI, your example is unsafe because it stores a GC'ed value -- the closure returned by `foo()` into a global variable. (The compiler reports as such for me.)
