Remove some objects of class "cl" from thread heap and add to central cache
| 216 | |
| 217 | // Remove some objects of class "cl" from thread heap and add to central cache |
| 218 | void ThreadCache::ReleaseToCentralCache(FreeList* src, size_t cl, int N) { |
| 219 | ASSERT(src == &list_[cl]); |
| 220 | if (N > src->length()) N = src->length(); |
| 221 | size_t delta_bytes = N * Static::sizemap()->ByteSizeForClass(cl); |
| 222 | |
| 223 | // We return prepackaged chains of the correct size to the central cache. |
| 224 | // TODO: Use the same format internally in the thread caches? |
| 225 | int batch_size = Static::sizemap()->num_objects_to_move(cl); |
| 226 | while (N > batch_size) { |
| 227 | void *tail, *head; |
| 228 | src->PopRange(batch_size, &head, &tail); |
| 229 | Static::central_cache()[cl].InsertRange(head, tail, batch_size); |
| 230 | N -= batch_size; |
| 231 | } |
| 232 | void *tail, *head; |
| 233 | src->PopRange(N, &head, &tail); |
| 234 | Static::central_cache()[cl].InsertRange(head, tail, N); |
| 235 | size_ -= delta_bytes; |
| 236 | } |
| 237 | |
| 238 | // Release idle memory to the central cache |
| 239 | void ThreadCache::Scavenge() { |
nothing calls this directly
no test coverage detected