]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: explain how to free something
authorRuss Cox <rsc@golang.org>
Wed, 31 Aug 2011 12:17:01 +0000 (08:17 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 31 Aug 2011 12:17:01 +0000 (08:17 -0400)
R=golang-dev, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4958053

src/cmd/cgo/doc.go

index cc608f40c26c43c18ec1d4847757bcc29ca46ba9..7faece81c8063d29105ab0f3e01813a043ffaf1b 100644 (file)
@@ -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