File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
core/src/verification/queue
sync/src/block/downloader Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -408,6 +408,7 @@ impl<K: Kind> VerificationQueue<K> {
408
408
* td -= score;
409
409
}
410
410
}
411
+ processing. shrink_to_fit ( ) ;
411
412
processing. is_empty ( )
412
413
}
413
414
@@ -429,6 +430,7 @@ impl<K: Kind> VerificationQueue<K> {
429
430
* td -= score;
430
431
}
431
432
}
433
+ processing. shrink_to_fit ( ) ;
432
434
433
435
let mut new_verified = VecDeque :: new ( ) ;
434
436
let mut removed_size = 0 ;
@@ -444,6 +446,7 @@ impl<K: Kind> VerificationQueue<K> {
444
446
new_verified. push_back ( output) ;
445
447
}
446
448
}
449
+ processing. shrink_to_fit ( ) ;
447
450
448
451
self . verification . sizes . verified . fetch_sub ( removed_size, AtomicOrdering :: SeqCst ) ;
449
452
* verified = new_verified;
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ impl BodyDownloader {
69
69
self . downloaded . insert ( hash, body) ;
70
70
}
71
71
}
72
+ self . downloading . shrink_to_fit ( ) ;
72
73
}
73
74
74
75
pub fn add_target ( & mut self , header : & Header , parent : & Header ) {
@@ -93,13 +94,17 @@ impl BodyDownloader {
93
94
self . downloading . remove ( hash) ;
94
95
self . downloaded . remove ( hash) ;
95
96
}
97
+ self . targets . shrink_to_fit ( ) ;
98
+ self . downloading . shrink_to_fit ( ) ;
99
+ self . downloaded . shrink_to_fit ( ) ;
96
100
}
97
101
98
102
pub fn reset_downloading ( & mut self , hashes : & [ H256 ] ) {
99
103
cdebug ! ( SYNC , "Remove downloading by timeout {:?}" , hashes) ;
100
104
for hash in hashes {
101
105
self . downloading . remove ( & hash) ;
102
106
}
107
+ self . downloading . shrink_to_fit ( ) ;
103
108
}
104
109
105
110
pub fn drain ( & mut self ) -> Vec < ( H256 , Vec < UnverifiedTransaction > ) > {
@@ -111,7 +116,9 @@ impl BodyDownloader {
111
116
break
112
117
}
113
118
}
119
+ self . downloaded . shrink_to_fit ( ) ;
114
120
self . targets . drain ( 0 ..result. len ( ) ) ;
121
+ self . targets . shrink_to_fit ( ) ;
115
122
result
116
123
}
117
124
}
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ impl HeaderDownloader {
187
187
}
188
188
}
189
189
}
190
+ self . queued . shrink_to_fit ( ) ;
190
191
}
191
192
192
193
pub fn mark_as_queued ( & mut self , hashes : Vec < H256 > ) {
@@ -195,5 +196,6 @@ impl HeaderDownloader {
195
196
self . queued . insert ( hash, header) ;
196
197
}
197
198
}
199
+ self . downloaded . shrink_to_fit ( ) ;
198
200
}
199
201
}
You can’t perform that action at this time.
0 commit comments