| 205 | } |
| 206 | |
| 207 | void* TensorPoolAllocator::Bin::Allocate(size_t total, size_t header_size) { |
| 208 | auto ptr = buffer_.Allocate(); |
| 209 | if (ptr != nullptr) { |
| 210 | return SetHeader(ptr, total, header_size, (void*)this, nullptr); |
| 211 | } |
| 212 | auto info = virtual_buffer_.Allocate(); |
| 213 | if (info.first != nullptr) { |
| 214 | return SetHeader(info.first, total, header_size, (void*)this, |
| 215 | info.second); |
| 216 | } |
| 217 | return nullptr; |
| 218 | } |
| 219 | |
| 220 | void TensorPoolAllocator::Bin::Deallocate(Header* header) { |
| 221 | if (header->internal_bin == nullptr) { |
no test coverage detected