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

Method Allocate

tensorflow/core/framework/ev_allocator.h:429–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427 }
428
429 void *Allocate() {
430 void *ret = nullptr;
431
432 if (list_.empty()) {
433 std::vector<void *> ptrs(kThreadLocalBinExchangeMaxPtrNum, nullptr);
434 int ptrs_num = arena_->BatchAllocate(kThreadLocalBinExchangeMaxPtrNum,
435 t_bin_size_, ptrs.data());
436 for (int i = 0; i < ptrs_num; i++) {
437 list_.push_front(ptrs[i]);
438 }
439 }
440
441 if (likely(!list_.empty())) {
442 ret = list_.back();
443 list_.pop_back();
444 }
445
446 return ret;
447 }
448
449 size_t BatchAllocate(size_t num, void **ret) {
450 if (list_.size() >= num) {

Callers

nothing calls this directly

Calls 6

push_frontMethod · 0.80
pop_backMethod · 0.80
emptyMethod · 0.45
BatchAllocateMethod · 0.45
dataMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected