MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / real_free

Method real_free

imperative/src/impl/interpreter/interpreter_impl.cpp:704–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702}
703
704void ChannelImpl::real_free(TensorInfo* ptr) {
705 auto& state = get_worker_state();
706 if (ptr->size_exceeds_thd(state.options.dtr_evictee_minimum_size)) {
707 m_dtr.erase_candidate(ptr);
708 }
709 detach_users(ptr);
710 ptr->detach_producer();
711 bool has_value = ptr->ptr != nullptr;
712 if (has_value) {
713 MGB_RECORD_EVENT(TensorReleaseEvent, ptr->id);
714 }
715 MGB_RECORD_EVENT(TensorEraseEvent, ptr->id, ptr->ptr_use_count);
716 ptr->status = TensorInfo::Deleted;
717 MGB_LOCK_GUARD(m_pool_spin);
718 m_pool.free(ptr);
719}
720
721std::unordered_set<ChannelImpl*> ChannelImpl::m_all_active_channels{};
722MGB_MUTEX ChannelImpl::m_all_active_channels_mutex{};

Callers

nothing calls this directly

Calls 4

size_exceeds_thdMethod · 0.80
erase_candidateMethod · 0.80
detach_producerMethod · 0.80
freeMethod · 0.45

Tested by

no test coverage detected