MCPcopy Create free account
hub / github.com/catboost/catboost / TryToFreeMemory

Method TryToFreeMemory

util/thread/lfstack.h:31–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 std::atomic<size_t> DequeueCount = 0;
30
31 void TryToFreeMemory() {
32 TNode* current = FreePtr.load(std::memory_order_acquire);
33 if (!current) {
34 return;
35 }
36 if (DequeueCount.load() == 1) {
37 // node current is in free list, we are the last thread so try to cleanup
38 if (FreePtr.compare_exchange_strong(current, nullptr)) {
39 EraseList(current);
40 }
41 }
42 }
43 void EraseList(TNode* p) {
44 while (p) {
45 TNode* next = p->Next;

Callers

nothing calls this directly

Calls 3

EraseListFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected