As the instruction of https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices shows, the GC of Go will not release it. An example as the following, but I have a question about when and how to release this `slice`?
import "C" import "unsafe" ... var theCArray *C.YourType = C.getTheArray() length := C.getTheArrayLength() slice := (*[1 << 30]C.YourType)(unsafe.Pointer(theCArray))[:length:length] It is important to keep in mind that the Go garbage collector will not > interact with this data, and that if it is freed from the C side of things, > the behavior of any Go code using the slice is nondeterministic. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.