stops consuming pinned vectors with a recycler (#16441)
If the vector is pinned and has a recycler, From<PinnedVec> implementation of Vec should clone (instead of consuming) the underlying vector so that the next allocation of a PinnedVec will recycle an already pinned one.
This commit is contained in:
@ -2816,7 +2816,7 @@ impl ClusterInfo {
|
||||
let packets: Vec<_> = requests_receiver.recv_timeout(RECV_TIMEOUT)?.packets.into();
|
||||
let mut packets = VecDeque::from(packets);
|
||||
while let Ok(packet) = requests_receiver.try_recv() {
|
||||
packets.extend(packet.packets.into_iter());
|
||||
packets.extend(packet.packets.iter().cloned());
|
||||
let excess_count = packets.len().saturating_sub(MAX_GOSSIP_TRAFFIC);
|
||||
if excess_count > 0 {
|
||||
packets.drain(0..excess_count);
|
||||
|
@ -59,7 +59,8 @@ impl VerifiedVotePackets {
|
||||
}
|
||||
let packets = votes
|
||||
.into_iter()
|
||||
.flat_map(|(_, (_, packets))| packets.packets.clone())
|
||||
.flat_map(|(_, (_, packets))| &packets.packets)
|
||||
.cloned()
|
||||
.collect();
|
||||
(new_update_version, Packets::new(packets))
|
||||
}
|
||||
|
Reference in New Issue
Block a user