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

Method Reallocate

cpp/src/arrow/memory_pool.cc:482–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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