FAQ
Hi golang-nuts,

Does the garbage collector pay attention to unsafe.Pointer the way that it does
for other pointers? As far as I can tell from reading the escape analysis code
it does, but I would like to confirm.

More specifically, if I do this:

     var b *byte = &make([]byte, 100)[0]

then I believe the garbage collector keeps the entire 100-byte array live. Is
that also true if I do this?

     var b = unsafe.Pointer(&make([]byte, 100)[0])

Thanks,
Aaron

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 15, '15 at 11:21p
activeJul 16, '15 at 3:49a
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase