2
gihnius 2013-12-02 21:51:10 +08:00 1
我只是新手.
data := C.malloc(...) defer C.free(data) 如果 data 在fn 里面 malloc 就不知道了.... 为什么不在里面 free 呢? |
3
guotie 2013-12-02 21:56:07 +08:00 1
要释放
C.free(data) |
5
wwwjfy 2013-12-04 21:37:17 +08:00 1
不是高手,用过两天..
http://golang.org/cmd/cgo/ // 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 (be sure to include stdlib.h // if C.free is needed). |