turn/ttorrent — pull request #28 by aluckyapple (2013-01-10 07:28:06+00:00)
Title:  Memory leak with SharedTorrent

Memory leak with SharedTorrent

this.rarest = Collections.synchronizedSortedSet(new TreeSet());

1.Code like this may build a big Red-Black Tree and GC cannot work well
piece.seenAt(peer);
this.rarest.remove(piece);
this.rarest.add(piece);

2.Iterating this.rarest also need being synchronized.

When I run ttorrent client to download a 45G-50G file, Object rarest can
easily run out the JVM memory. If I run multi-instances of ttorrent
client, my PC will run out memory quickly and cannot work.

I use jmap+MemoryAnalyzer and jvisualvm to analyze this problem.

Am i right? Thx.