MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DeallocateRaw

Method DeallocateRaw

tensorflow/core/common_runtime/pool_allocator.cc:135–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void PoolAllocator::DeallocateRaw(void* ptr) {
136 if (ptr == nullptr) return;
137 ChunkPrefix* cp = FindPrefix(ptr);
138 CHECK_LE((void*)cp, (void*)ptr);
139 if (!has_size_limit_ && !auto_resize_) {
140 allocator_->Free(cp, cp->num_bytes);
141 } else {
142 mutex_lock lock(mutex_);
143 ++put_count_;
144 while (pool_.size() >= pool_size_limit_) {
145 EvictOne();
146 }
147 PtrRecord* pr = new PtrRecord;
148 pr->num_bytes = cp->num_bytes;
149 pr->ptr = cp;
150 AddToList(pr);
151 pool_.insert(std::make_pair(cp->num_bytes, pr));
152 }
153}
154
155void PoolAllocator::Clear() {
156 if (has_size_limit_) {

Callers

nothing calls this directly

Calls 4

FindPrefixFunction · 0.85
FreeMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected