From: Russ Cox Date: Wed, 31 Aug 2011 12:17:01 +0000 (-0400) Subject: cgo: explain how to free something X-Git-Tag: weekly.2011-09-01~8 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0c9ea63b3b3cc7bbbd7309cc8ca1751f3ea58ba0;p=gostls13.git cgo: explain how to free something R=golang-dev, n13m3y3r, r CC=golang-dev https://golang.org/cl/4958053 --- diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index cc608f40c2..7faece81c8 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -72,7 +72,10 @@ the pointer to the first element explicitly: C.f(&x[0]). A few special functions convert between Go and C types by making copies of the data. In pseudo-Go definitions: - // Go string to C string - result is not garbage collected + // Go string to C string + // The C string is allocated in the C heap using malloc. + // It is the caller's responsibility to arrange for it to be + // freed, such as by calling C.free. func C.CString(string) *C.char // C string to Go string