| 666 | } |
| 667 | |
| 668 | void ChannelImpl::free(TensorInfo* ptr) { |
| 669 | auto& state = get_worker_state(); |
| 670 | if (state.options.enable_dtr_auto_drop) { |
| 671 | // Evicting a tensor, rather than freeing it, can avoid pinning |
| 672 | // potentially exploding amounts of memory and allow us to save |
| 673 | // more memory. |
| 674 | ptr->allow_delete = true; |
| 675 | if (!ptr->ref_cnt) { |
| 676 | recursive_free(ptr); |
| 677 | } else { |
| 678 | do_drop(ptr); |
| 679 | } |
| 680 | } else { |
| 681 | real_free(ptr); |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | void ChannelImpl::recursive_free(TensorInfo* ptr) { |
| 686 | MGB_RECORD_EVENT(TensorCommandEvent, ptr->id, TensorCommandKind::RecFree); |
no outgoing calls
no test coverage detected