Lines Matching full:segment
41 // The sum of the bytes of one segment of each size. in ConfigureSegmentPool()
55 // full_size. If max_pool_size is no sum of segment sizes the actual pool in ConfigureSegmentPool()
58 // TODO(heimbuef): Determine better strategy generating a segment sizes in ConfigureSegmentPool()
74 Segment* AccountingAllocator::GetSegment(size_t bytes) { in GetSegment()
75 Segment* result = GetSegmentFromPool(bytes); in GetSegment()
86 Segment* AccountingAllocator::AllocateSegment(size_t bytes) { in AllocateSegment()
96 return reinterpret_cast<Segment*>(memory); in AllocateSegment()
99 void AccountingAllocator::ReturnSegment(Segment* segment) { in ReturnSegment() argument
100 segment->ZapContents(); in ReturnSegment()
103 FreeSegment(segment); in ReturnSegment()
104 } else if (!AddSegmentToPool(segment)) { in ReturnSegment()
105 FreeSegment(segment); in ReturnSegment()
109 void AccountingAllocator::FreeSegment(Segment* memory) { in FreeSegment()
128 Segment* AccountingAllocator::GetSegmentFromPool(size_t requested_size) { in GetSegmentFromPool()
139 Segment* segment; in GetSegmentFromPool() local
143 segment = unused_segments_heads_[power]; in GetSegmentFromPool()
145 if (segment != nullptr) { in GetSegmentFromPool()
146 unused_segments_heads_[power] = segment->next(); in GetSegmentFromPool()
147 segment->set_next(nullptr); in GetSegmentFromPool()
151 ¤t_pool_size_, -static_cast<base::AtomicWord>(segment->size())); in GetSegmentFromPool()
155 if (segment) { in GetSegmentFromPool()
156 DCHECK_GE(segment->size(), requested_size); in GetSegmentFromPool()
158 return segment; in GetSegmentFromPool()
161 bool AccountingAllocator::AddSegmentToPool(Segment* segment) { in AddSegmentToPool() argument
162 size_t size = segment->size(); in AddSegmentToPool()
182 segment->set_next(unused_segments_heads_[power]); in AddSegmentToPool()
183 unused_segments_heads_[power] = segment; in AddSegmentToPool()
196 Segment* current = unused_segments_heads_[power]; in ClearPool()
198 Segment* next = current->next(); in ClearPool()