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

Method Allocate

cpp/src/arrow/memory_pool.cc:461–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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