On Fri, Aug 18, 2017 at 5:36 PM, Justin Israel <justinisr...@gmail.com> wrote:
>
> I have cgo code that looks like this in a few of my own libs and I just
> started seeing crashes like this as of Go 1.8. Could it be related to the
> need for using runtime.KeepAlive? I have been adding that to my functions
> that look like this

As a general guideline, the only code that should require
runtime.KeepAlive is code that uses runtime.SetFinalizer.  If you
never use SetFinalizer, you should not need to use KeepAlive.

Either way, memory allocated by C.CString or C.malloc will never be
touched by the Go garbage collector, and using runtime.KeepAlive on it
will not have any effect.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to