Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage memory leak fix #249

Merged
merged 5 commits into from Jan 21, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

cmd: sum up & display storage pieces memory usage

  • Loading branch information
astro committed Jan 21, 2015
commit 4d74b51b252dc23d4cb9a886823f356c8d4d78d9
@@ -438,11 +438,14 @@ function drawTorrent (torrent) {
'{green:blocked:} {bold:' + torrent.numBlockedPeers + '}'
)
clivas.line('{80:}')
linesremaining -= 8
linesremaining -= 9

var pieces = torrent.storage.pieces
var storageMem = 0
for (var i = 0; i < pieces.length; i++) {
var piece = pieces[i]
if (piece.buffer)
storageMem += piece.buffer.length
if (piece.verified || piece.blocksWritten === 0) {
continue;
}
@@ -453,6 +456,9 @@ function drawTorrent (torrent) {
clivas.line('{4+cyan:' + i + '} ' + bar);
linesremaining -= 1
}
clivas.line(
'{red:storage mem:} {bold:' + Math.ceil(storageMem / 1024) + ' KB} '
)
clivas.line('{80:}')
linesremaining -= 1

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.