From 37d03d1e5692d9f283bd82bdc4674b934d9eddcb Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 24 Sep 2017 20:08:26 -0700 Subject: [PATCH] peer: avoid possible GC leak by setting popped queue element to nil --- peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer.go b/peer.go index 600fbce16..f323ce964 100644 --- a/peer.go +++ b/peer.go @@ -537,6 +537,7 @@ func (c *chanMsgStream) msgConsumer() { // slice's reference down one in order to remove the message // from the queue. msg := c.msgs[0] + c.msgs[0] = nil // Set to nil to prevent GC leak. c.msgs = c.msgs[1:] // We'll send a message to the funding manager and wait iff an @@ -859,6 +860,9 @@ func (p *peer) queueHandler() { // If there weren't any messages to send, or the writehandler // is still blocked, then we'll accept a new message into the // queue from outside sub-systems. + // + // TODO(roasbeef): need send clause here as well to account for + // writeHandler blocking? select { case <-p.quit: return