MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / release

Method release

common/script/scriptheap.cpp:108–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool ScriptHeap::release(void* ptr)
109{
110 if (!ptr) {
111 return false;
112 }
113 Deleter deleter = nullptr;
114 {
115 std::lock_guard<std::mutex> lock(mMutex);
116 auto it = mBlocks.find(ptr);
117 if (it == mBlocks.end()) {
118 return false;
119 }
120 deleter = it->second;
121 mBlocks.erase(it);
122 }
123 // Outside the lock: a deleter is free() or a C++ destructor, neither of
124 // which needs the map, and both of which can be slow.
125 deleter(ptr);
126 return true;
127}
128
129bool ScriptHeap::owns(void* ptr) const
130{

Callers 6

savReadMethod · 0.80
savReadMethod · 0.80
createFunction · 0.80
ckpt_json_deleteFunction · 0.80
ckpt_delete_directoryFunction · 0.80
ckpt_script_freeFunction · 0.80

Calls 3

findMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected