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

Method Reallocate

cpp/src/arrow/memory_pool.cc:487–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485 }
486
487 Status Reallocate(int64_t old_size, int64_t new_size, int64_t alignment,
488 uint8_t** ptr) override {
489 if (new_size < 0) {
490 return Status::Invalid("negative realloc size");
491 }
492 if (static_cast<uint64_t>(new_size) >= std::numeric_limits<size_t>::max()) {
493 return Status::OutOfMemory("realloc overflows size_t");
494 }
495 RETURN_NOT_OK(Allocator::ReallocateAligned(old_size, new_size, alignment, ptr));
496#ifndef NDEBUG
497 // Poison data
498 if (new_size > old_size) {
499 DCHECK_NE(*ptr, nullptr);
500 (*ptr)[old_size] = kReallocPoison;
501 (*ptr)[new_size - 1] = kReallocPoison;
502 }
503#endif
504
505 stats_.DidReallocateBytes(old_size, new_size);
506 return Status::OK();
507 }
508
509 void Free(uint8_t* buffer, int64_t size, int64_t alignment) override {
510#ifndef NDEBUG

Callers

nothing calls this directly

Calls 4

OutOfMemoryFunction · 0.85
DidReallocateBytesMethod · 0.80
InvalidFunction · 0.70
OKFunction · 0.70

Tested by

no test coverage detected