Go has a garbage collector for slices that only frees the slice when all references to it are dead. It also has an Mmap function that returns a []byte
that can be explicitly freed with Munmap()
. So how does this work with Go's garbage collector.
What happens if I do this?
m := syscall.Mmap(...)
m2 = m[10:100]
syscall.Munmap(m)
a = m2[0]