From 631e18d23104b4a570870030f7fbcc149a6b3c2a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 23 Jul 2018 10:28:11 +1000 Subject: [PATCH] Set Torrent.pieces cap too We know exactly how many we want, and don't want to use any more memory. --- torrent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.48.1