Returns 'byte_size' to the current chunk back to the mem pool. This can only be used to return either all or part of the previous allocation returned by Allocate().
| 157 | /// only be used to return either all or part of the previous allocation returned |
| 158 | /// by Allocate(). |
| 159 | void ReturnPartialAllocation(int64_t byte_size) { |
| 160 | DFAKE_SCOPED_LOCK(mutex_); |
| 161 | DCHECK_GE(byte_size, 0); |
| 162 | DCHECK(current_chunk_idx_ != -1); |
| 163 | ChunkInfo& info = chunks_[current_chunk_idx_]; |
| 164 | DCHECK_GE(info.allocated_bytes, byte_size); |
| 165 | info.allocated_bytes -= byte_size; |
| 166 | ASAN_POISON_MEMORY_REGION(info.data + info.allocated_bytes, byte_size); |
| 167 | total_allocated_bytes_ -= byte_size; |
| 168 | } |
| 169 | |
| 170 | /// Return a dummy pointer for zero-length allocations. |
| 171 | static uint8_t* EmptyAllocPtr() { |
no outgoing calls