MCPcopy Create free account
hub / github.com/beefytech/Beef / ListTooLong

Method ListTooLong

BeefRT/gperftools/src/thread_cache.cc:193–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193void ThreadCache::ListTooLong(FreeList* list, size_t cl) {
194 const int batch_size = Static::sizemap()->num_objects_to_move(cl);
195 ReleaseToCentralCache(list, cl, batch_size);
196
197 // If the list is too long, we need to transfer some number of
198 // objects to the central cache. Ideally, we would transfer
199 // num_objects_to_move, so the code below tries to make max_length
200 // converge on num_objects_to_move.
201
202 if (list->max_length() < batch_size) {
203 // Slow start the max_length so we don't overreserve.
204 list->set_max_length(list->max_length() + 1);
205 } else if (list->max_length() > batch_size) {
206 // If we consistently go over max_length, shrink max_length. If we don't
207 // shrink it, some amount of memory will always stay in this freelist.
208 list->set_length_overages(list->length_overages() + 1);
209 if (list->length_overages() > kMaxOverages) {
210 ASSERT(list->max_length() > batch_size);
211 list->set_max_length(list->max_length() - batch_size);
212 list->set_length_overages(0);
213 }
214 }
215}
216
217// Remove some objects of class "cl" from thread heap and add to central cache
218void ThreadCache::ReleaseToCentralCache(FreeList* src, size_t cl, int N) {

Callers

nothing calls this directly

Calls 5

num_objects_to_moveMethod · 0.45
max_lengthMethod · 0.45
set_max_lengthMethod · 0.45
set_length_overagesMethod · 0.45
length_overagesMethod · 0.45

Tested by

no test coverage detected