MCPcopy Create free account
hub / github.com/apache/impala / Free

Method Free

be/src/runtime/free-pool.h:98–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96 }
97
98 void Free(uint8_t* ptr) {
99 if (UNLIKELY(ptr == nullptr || ptr == mem_pool_->EmptyAllocPtr())) return;
100 --net_allocations_;
101 FreeListNode* node = reinterpret_cast<FreeListNode*>(ptr - sizeof(FreeListNode));
102 FreeListNode* list = node->list;
103#ifndef NDEBUG
104 CheckValidAllocation(list, ptr);
105#endif
106 // Add node to front of list.
107 node->next = list->next;
108 list->next = node;
109
110#ifdef ADDRESS_SANITIZER
111 int bucket_idx = (list - &lists_[0]);
112 DCHECK_LT(bucket_idx, NUM_LISTS);
113 int64_t allocation_size = 1LL << bucket_idx;
114 ASAN_POISON_MEMORY_REGION(ptr, allocation_size);
115 alloc_to_size_.erase(ptr);
116#endif
117 }
118
119 /// Returns an allocation that is at least 'size'. If the current allocation backing
120 /// 'ptr' is big enough, 'ptr' is returned. Otherwise a new one is made and the contents

Callers

nothing calls this directly

Calls 2

EmptyAllocPtrMethod · 0.80
eraseMethod · 0.80

Tested by

no test coverage detected