(to short circuit any question, I have already 
read https://golang.org/pkg/unsafe/ )

If I create an unsafe.Pointer that points to an invalid memory address, but 
I never deference it or otherwise pass it along, what happens to it?  Is it 
a valid go program to just create such a pointer?  The main reason I ask is 
that I know the GC treats unsafe.Pointer values differently than uintptr.  
If the GC were to chase this invalid pointer, it would likely get a 
segfault.  This means that either the GC knows not to chase such a pointer, 
or it would chase it and gracefully recover.  

Additionally, if the unsafe.Pointer is pointing to a incorrectly aligned 
address, the GC could potentially misunderstand and try to walk it.  I'm 
sure this has been thought of before, but it isn't called out in the docs.


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