issue with past-the-end pointer

110 views
Skip to first unread message

Vincent Blanchon

unread,
Mar 18, 2020, 12:33:13 PM3/18/20
to golang-nuts
Hi all,

In this proposal https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md, it is mentioned past-the-end pointer and the fact it should be avoided. My assumption is that it could lead to a bad memory tracking/cleaning since the write barriers keep track of the change in the pointers. Is that correct?

Thank you

Ian Lance Taylor

unread,
Mar 18, 2020, 3:20:15 PM3/18/20
to Vincent Blanchon, golang-nuts
On Wed, Mar 18, 2020 at 9:33 AM Vincent Blanchon
<blanchon...@gmail.com> wrote:
>
> In this proposal https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md, it is mentioned past-the-end pointer and the fact it should be avoided. My assumption is that it could lead to a bad memory tracking/cleaning since the write barriers keep track of the change in the pointers. Is that correct?

Pretty much, yes. A past-the-end pointer looks like a pointer to the
next object, and the write barrier can't tell the difference.

Ian

Vincent Blanchon

unread,
Mar 18, 2020, 10:40:39 PM3/18/20
to golang-nuts
Thank you Ian!
Reply all
Reply to author
Forward
0 new messages