Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1610)

Issue 875043: code review 875043: net: use chan bool instead of chan *netFD to avoid cycle (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 11 months ago by rsc
Modified:
14 years, 11 months ago
Reviewers:
CC:
r, golang-dev
Visibility:
Public.

Description

net: use chan bool instead of chan *netFD to avoid cycle The cycle is *netFD -> cw chanl *netFD in struct -> same *netFD in channel read buffer. Because channels are finalized, the cycle makes them uncollectable. A better fix is to make channels not finalized anymore, and that will happen, but this is an easy, reasonable workaround until then. Another good fix would be to zero the channel receive buffer entry after the receive. That too will happen.

Patch Set 1 #

Patch Set 2 : code review 875043: net: use chan bool instead of chan *netFD to avoid cycle #

Patch Set 3 : code review 875043: net: use chan bool instead of chan *netFD to avoid cycle #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -8 lines) Patch
M src/pkg/net/fd.go View 4 chunks +8 lines, -8 lines 0 comments Download

Messages

Total messages: 3
rsc
Hello r (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 11 months ago (2010-04-06 23:28:58 UTC) #1
r
LGTM
14 years, 11 months ago (2010-04-06 23:30:27 UTC) #2
rsc
14 years, 11 months ago (2010-04-06 23:50:30 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=f4bb3941e621 ***

net: use chan bool instead of chan *netFD to avoid cycle

The cycle is *netFD -> cw chanl *netFD in struct ->
same *netFD in channel read buffer.

Because channels are finalized, the cycle makes them
uncollectable.  A better fix is to make channels not
finalized anymore, and that will happen, but this is
an easy, reasonable workaround until then.

Another good fix would be to zero the channel receive
buffer entry after the receive.  That too will happen.

R=r
CC=golang-dev
http://codereview.appspot.com/875043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b