| 211 | } |
| 212 | |
| 213 | size_t TrackingAllocator::AllocatedSize(const void* ptr) const { |
| 214 | if (track_sizes_locally_) { |
| 215 | mutex_lock lock(mu_); |
| 216 | auto it = in_use_.find(ptr); |
| 217 | if (it != in_use_.end()) { |
| 218 | return (*it).second.allocated_size; |
| 219 | } |
| 220 | return 0; |
| 221 | } else { |
| 222 | return allocator_->AllocatedSize(ptr); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | int64 TrackingAllocator::AllocationId(const void* ptr) const { |
| 227 | if (track_sizes_locally_) { |
no test coverage detected