| 204 | } |
| 205 | |
| 206 | void Free(Tensor* tensor) |
| 207 | { |
| 208 | void* addr = get_tensor_mem(tensor); |
| 209 | |
| 210 | if(addr_map.count(addr) == 0) |
| 211 | return; |
| 212 | |
| 213 | auto ir = addr_map.find(addr); |
| 214 | |
| 215 | int idx = ir->second; |
| 216 | |
| 217 | MemBlock* p_block = &block_list[idx]; |
| 218 | |
| 219 | p_block->ref_count--; |
| 220 | |
| 221 | if(p_block->ref_count == 0) |
| 222 | { |
| 223 | addr_map.erase(ir); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | mem_alloc_t mem_alloc; |
| 228 | mem_free_t mem_free; |
no test coverage detected