I read in some stack-overflow about Go's GC.
Stack and heap models in Go Garbage collector I want to know that if a variable needs to be defined in heap or stack in Go and then if GC want to collect it, what algorithm is used for this?
If we assume that in languages that have GC that heap is more efficient, but what about Rust and how does rust handle this in compare to Go?
Especially about reference counter in Go that we have no choice in most of times to ask compiler but such a tool exist and it does its job on its own way!
I read this : Stack vs heap allocation of structs in Go, and how they relate to garbage collection