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

Method alloc

src/core/impl/comp_node/comp_node.cpp:92–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92CompNode::Event* CompNode::EventPool::alloc() {
93 MGB_LOCK_GUARD(m_lock);
94 if (!m_free.empty()) {
95 auto rst = m_free.back();
96 m_free.pop_back();
97 return rst;
98 }
99 m_allocated.push_back(m_cn.create_event(m_flags));
100 return m_allocated.back().get();
101}
102
103void CompNode::EventPool::free(CompNode::Event* ev) {
104 MGB_LOCK_GUARD(m_lock);

Callers

nothing calls this directly

Calls 6

backMethod · 0.80
emptyMethod · 0.45
pop_backMethod · 0.45
push_backMethod · 0.45
create_eventMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected