| 145 | } |
| 146 | |
| 147 | void ScopedAllocatorInstance::DropFromTable() { |
| 148 | bool del = false; |
| 149 | { |
| 150 | mutex_lock l(mu_); |
| 151 | CHECK(in_table_); |
| 152 | in_table_ = false; |
| 153 | VLOG(2) << "ScopedAllocatorInstance::DropFromTable " << this |
| 154 | << " allocated_ " << allocated_ << " deallocated_ " << deallocated_ |
| 155 | << " in_table_ " << in_table_; |
| 156 | // Single use is complete when it is allocated and deallocated. |
| 157 | // This check prevents a race between Allocating the tensor slice and |
| 158 | // Dropping it from the parent container's table. |
| 159 | if (allocated_ && deallocated_) { |
| 160 | del = true; |
| 161 | } |
| 162 | } |
| 163 | if (del) delete this; |
| 164 | } |
| 165 | |
| 166 | void* ScopedAllocatorInstance::AllocateRaw(size_t alignment, size_t num_bytes) { |
| 167 | void* ptr = scoped_allocator_->AllocateRaw(field_index_, num_bytes); |
no outgoing calls
no test coverage detected