Re: unsafe.Pointer GCing

60 views
Skip to first unread message

Gustavo Niemeyer

unread,
Aug 28, 2013, 8:09:32 PM8/28/13
to golang-dev
This is more likely to find the proper eyes on golang-dev:

On Wed, Aug 28, 2013 at 3:00 PM, Gustavo Niemeyer <gus...@niemeyer.net> wrote:
> Has the situation of the GCing of values referenced by unsafe.Pointer
> been affected at all after the recent precise improvements, or are
> those values still not considered as a reference?


Thanks,

gustavo @ http://niemeyer.net

Keith Randall

unread,
Aug 28, 2013, 8:41:21 PM8/28/13
to Gustavo Niemeyer, golang-dev
unsafe.Pointer is considered a pointer by the GC.  It is and always was, I don't know what you mean by "still not considered as a reference".

uintptr(unsafe.Pointer) is no longer considered to be a pointer by the GC.  If you do this and don't retain another reference to the underlying object, expect the GC to collect the object.




--

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

Gustavo Niemeyer

unread,
Aug 28, 2013, 9:33:00 PM8/28/13
to Keith Randall, golang-dev
On Wed, Aug 28, 2013 at 9:41 PM, Keith Randall <k...@google.com> wrote:
> unsafe.Pointer is considered a pointer by the GC. It is and always was, I
> don't know what you mean by "still not considered as a reference".

Sorry, I was lazy and read the first few messages from Ian on this thread:

https://groups.google.com/forum/#!topic/golang-nuts/yNis7bQG_rY

I should have read until the end after <atom> offers more details.

> uintptr(unsafe.Pointer) is no longer considered to be a pointer by the GC.
> If you do this and don't retain another reference to the underlying object,
> expect the GC to collect the object.

Thanks.


gustavo @ http://niemeyer.net
Reply all
Reply to author
Forward
0 new messages