Re: [go-nuts] i can't use defer c.free to release the cgo.cstring memory when my func return the cstring

2020-11-17 Thread 杜仲
that's the problem, i use c just like an channel, the value final send to other language. i know i can make an call back function in c and then release that memory in c code. regrettably, this will take many time and i don;t have so much. however ,thx 在2020年11月18日星期三 UTC+8 上午10:43:20 写道: > On

Re: [go-nuts] i can't use defer c.free to release the cgo.cstring memory when my func return the cstring

2020-11-17 Thread Ian Lance Taylor
On Tue, Nov 17, 2020 at 6:38 PM 杜仲 wrote: > > my go version is 1.13. > i used cgo.cstring in my func, and the func will return cstring. > i don't know when c complete work about the cstring memory. > if i used defer c.free to release the cstring memory, the cstring val will > change and return a

[go-nuts] i can't use defer c.free to release the cgo.cstring memory when my func return the cstring

2020-11-17 Thread 杜仲
my go version is 1.13. i used cgo.cstring in my func, and the func will return cstring. i don't know when c complete work about the cstring memory. if i used defer c.free to release the cstring memory, the cstring val will change and return a unexpected value, especially at often apply memory on