| 90 | } |
| 91 | |
| 92 | void TRTDeviceAllocator::free(void* memory) noexcept { |
| 93 | VLOG(2) << "Deallocating @ " << memory; |
| 94 | // allocated memory adjusted for alignment, restore the original pointer |
| 95 | if (memory) { |
| 96 | auto alloc_mem = mem_map_.find(memory); |
| 97 | if (alloc_mem != mem_map_.end()) { |
| 98 | memory = alloc_mem->second; |
| 99 | mem_map_.erase(alloc_mem->first); |
| 100 | } |
| 101 | allocator_->DeallocateRaw(memory); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | } // namespace tensorrt |
| 106 | } // namespace tensorflow |