3 ms·
If the Go compiler can't tell anything about the length of storage of a slice, it'll end up in heap. The stack is usually only used when escape analysis determi
by zaarn 9y ago
If the Go compiler can't tell anything about the length of storage of a slice, it'll end up in heap. The stack is usually only used when escape analysis determines that the value does not survive the function call, atleast IIRC.
Slices should be capable of being partially deallocate so long as the backing arrays are not referenced anymore.