diff options
author | Russ Cox <rsc@golang.org> | 2011-08-31 08:17:01 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-08-31 08:17:01 -0400 |
commit | 0c9ea63b3b3cc7bbbd7309cc8ca1751f3ea58ba0 (patch) | |
tree | 4f2bc1a1f91fb75c813012311bb600638e13617f | |
parent | 335da67e00baecf05035f97ef578abf3f35ba82a (diff) | |
download | go-0c9ea63b3b3cc7bbbd7309cc8ca1751f3ea58ba0.tar.gz go-0c9ea63b3b3cc7bbbd7309cc8ca1751f3ea58ba0.zip |
cgo: explain how to free something
R=golang-dev, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4958053
-rw-r--r-- | src/cmd/cgo/doc.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 |