This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memory managed by Go can't be passed to C as of Go 1.6
Discussion at: golang/go#12416 https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md Issues with the Go memory management code were hacked around by adding a new check that ensured that pointers to memory managed by Go are never passed to cgo code, since one can not be sure how and where pointers to Go memory are being stored in the C code. As a result, the memory must be manually malloc'd and free'd by cgo, even if it's a Go object in the C memory. The userdata fix makes this change explicit, by running a malloc and free using cgo, to explicitly control the memory management.
- Loading branch information