forked from premiere/premiere-libtorrent
shrink peers vectors with too much excess capacity
This commit is contained in:
parent
89942bf3d4
commit
35cfc6b5d3
|
@ -525,6 +525,9 @@ namespace
|
||||||
|
|
||||||
m_counters.peers -= std::distance(new_end, peers.end());
|
m_counters.peers -= std::distance(new_end, peers.end());
|
||||||
peers.erase(new_end, peers.end());
|
peers.erase(new_end, peers.end());
|
||||||
|
// if we're using less than 1/4 of the capacity free up the excess
|
||||||
|
if (!peers.empty() && peers.capacity() / peers.size() >= 4u)
|
||||||
|
peers.shrink_to_fit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue