Commit 7446b0c8 authored by Steven Allen's avatar Steven Allen

nil out references to finished dials

We need a better solution (this is a memory hotspot when mass dialing) but that
will take some thought and effort. This is a simple fix that should reduce
memory usage a bit.
parent 417b5f23
......@@ -71,6 +71,7 @@ func (dl *dialLimiter) finishedDial(dj *dialJob) {
if len(dl.waitingOnFd) > 0 {
next := dl.waitingOnFd[0]
dl.waitingOnFd[0] = nil // clear out memory
dl.waitingOnFd = dl.waitingOnFd[1:]
if len(dl.waitingOnFd) == 0 {
dl.waitingOnFd = nil // clear out memory
......@@ -94,6 +95,7 @@ func (dl *dialLimiter) finishedDial(dj *dialJob) {
if len(waitlist) == 1 {
delete(dl.waitingOnPeerLimit, dj.peer)
} else {
waitlist[0] = nil // clear out memory
dl.waitingOnPeerLimit[dj.peer] = waitlist[1:]
}
dl.activePerPeer[dj.peer]++ // just kidding, we still want this token
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment