MCPcopy Create free account
hub / github.com/apache/arrow / Allocate

Method Allocate

cpp/src/arrow/memory_pool.cc:466–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464 ~BaseMemoryPoolImpl() override {}
465
466 Status Allocate(int64_t size, int64_t alignment, uint8_t** out) override {
467 if (size < 0) {
468 return Status::Invalid("negative malloc size");
469 }
470 if (static_cast<uint64_t>(size) >= std::numeric_limits<size_t>::max()) {
471 return Status::OutOfMemory("malloc size overflows size_t");
472 }
473 RETURN_NOT_OK(Allocator::AllocateAligned(size, alignment, out));
474#ifndef NDEBUG
475 // Poison data
476 if (size > 0) {
477 DCHECK_NE(*out, nullptr);
478 (*out)[0] = kAllocPoison;
479 (*out)[size - 1] = kAllocPoison;
480 }
481#endif
482
483 stats_.DidAllocateBytes(size);
484 return Status::OK();
485 }
486
487 Status Reallocate(int64_t old_size, int64_t new_size, int64_t alignment,
488 uint8_t** ptr) override {

Callers

nothing calls this directly

Calls 4

OutOfMemoryFunction · 0.85
DidAllocateBytesMethod · 0.80
InvalidFunction · 0.70
OKFunction · 0.70

Tested by

no test coverage detected