On Wed, Oct 19, 2016 at 9:04 AM,  <andrew.sm...@miracl.com> wrote:
>> I have a follow up question.  In the above example does golang give any
>> guarantee about the earliest point at which the temporay WrappedString
>> instance is collected. I mean, is it possible that the GC will collect the
>> WrappedString whilst the function simulatedCall is still executing (and
>> thereby destroying the gchar* string whilst in use) :
>
>
>
>         simulatedCCall(NewWrappedString("fred").s)

Yes, for code like that it is unlikely but possible that the memory
allocated by NewWrappedString will be collected, and the finalizer
run, while executing the function.  Use runtime.KeepAlive to avoid
this.

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