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
: > 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 memor

[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