aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-05-31 14:41:24 -0400
committerRuss Cox <rsc@golang.org>2011-05-31 14:41:24 -0400
commit6216307e25d00bfd5ca18b8dacbb6ac85f2b9d6a (patch)
tree83908d8b0851d7d64681df02ab0313b8ab04e619
parent2261021be1b7ecc0c0fbd4a62250e2dfe5b81eb5 (diff)
downloadgo-6216307e25d00bfd5ca18b8dacbb6ac85f2b9d6a.tar.gz
go-6216307e25d00bfd5ca18b8dacbb6ac85f2b9d6a.zip
misc/cgo: remove reference to 'destroy' function
R=golang-dev, gri CC=golang-dev https://golang.org/cl/4558042
-rw-r--r--misc/cgo/gmp/gmp.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/misc/cgo/gmp/gmp.go b/misc/cgo/gmp/gmp.go
index f7bbe9c514..7faa71b696 100644
--- a/misc/cgo/gmp/gmp.go
+++ b/misc/cgo/gmp/gmp.go
@@ -86,9 +86,8 @@ explicitly in Go to pointers to arrays, as they do (implicitly) in C.
Garbage collection is the big problem. It is fine for the Go world to
have pointers into the C world and to free those pointers when they
-are no longer needed. To help, the garbage collector calls an
-object's destroy() method prior to collecting it. C pointers can be
-wrapped by Go objects with appropriate destroy methods.
+are no longer needed. To help, the Go code can define Go objects
+holding the C pointers and use runtime.SetFinalizer on those Go objects.
It is much more difficult for the C world to have pointers into the Go
world, because the Go garbage collector is unaware of the memory