mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
(trunk libT) blockIteratorNew() was overallocating much more memory than it used.
This commit is contained in:
@@ -687,7 +687,7 @@ blockIteratorNew( Torrent * t )
|
||||
struct tr_blockIterator * i = tr_new0( struct tr_blockIterator, 1 );
|
||||
i->t = t;
|
||||
i->pieces = getPreferredPieces( t, &i->pieceCount );
|
||||
i->blocks = tr_new0( tr_block_index_t, t->tor->blockCount );
|
||||
i->blocks = tr_new0( tr_block_index_t, t->tor->blockCountInPiece );
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -715,6 +715,8 @@ blockIteratorNext( struct tr_blockIterator * i, tr_block_index_t * setme )
|
||||
i->blocks[i->blockCount++] = block;
|
||||
}
|
||||
|
||||
assert( i->blockCount <= tor->blockCountInPiece );
|
||||
|
||||
if(( found = ( i->blockIndex < i->blockCount )))
|
||||
*setme = i->blocks[i->blockIndex++];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user