I wondered if Go might be implemented with a Mark & Compact garbage
collector. Some code in the Go standard library (notably sync.copyChecker)
seems to assume that the following holds:

obj := new(something)
ptrA := uintptr(unsafe.Pointer(obj))
/* various stuff */
ptrB := uintptr(unsafe.Pointer(obj))

/* Does this hold? */
ptrA == ptrB

Does this assumption hold? I.e. can I assume that once I convert an
unsafe.Pointer to an uintptr, the object I point to doesn't move in memory
anymore? I asked a question <http://stackoverflow.com/q/22195919/417501>about this issue before, but the results where a little bit inconclusive.

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/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 6 | next ›
Discussion Overview
groupgolang-nuts @
postedMar 5, '14 at 2:16p
activeMar 14, '14 at 8:30p



site design / logo © 2022 Grokbase