From: Matt Joiner Date: Mon, 23 Jul 2018 00:28:11 +0000 (+1000) Subject: Set Torrent.pieces cap too X-Git-Tag: v1.0.0~66 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=631e18d23104b4a570870030f7fbcc149a6b3c2a;p=btrtrc.git Set Torrent.pieces cap too We know exactly how many we want, and don't want to use any more memory. --- diff --git a/torrent.go b/torrent.go index 07773739..9aebad90 100644 --- a/torrent.go +++ b/torrent.go @@ -324,7 +324,7 @@ func infoPieceHashes(info *metainfo.Info) (ret []string) { func (t *Torrent) makePieces() { hashes := infoPieceHashes(t.info) - t.pieces = make([]Piece, len(hashes)) + t.pieces = make([]Piece, len(hashes), len(hashes)) for i, hash := range hashes { piece := &t.pieces[i] piece.t = t