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

Method ReallocateAligned

cpp/src/arrow/memory_pool.cc:413–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411 static void ReleaseUnused() { mi_collect(true); }
412
413 static Status ReallocateAligned(int64_t old_size, int64_t new_size, int64_t alignment,
414 uint8_t** ptr) {
415 uint8_t* previous_ptr = *ptr;
416 if (previous_ptr == memory_pool::internal::kZeroSizeArea) {
417 DCHECK_EQ(old_size, 0);
418 return AllocateAligned(new_size, alignment, ptr);
419 }
420 if (new_size == 0) {
421 DeallocateAligned(previous_ptr, old_size, alignment);
422 *ptr = memory_pool::internal::kZeroSizeArea;
423 return Status::OK();
424 }
425 *ptr = reinterpret_cast<uint8_t*>(
426 mi_realloc_aligned(previous_ptr, static_cast<size_t>(new_size), alignment));
427 if (*ptr == NULL) {
428 *ptr = previous_ptr;
429 return Status::OutOfMemory("realloc of size ", new_size, " failed");
430 }
431 return Status::OK();
432 }
433
434 static void DeallocateAligned(uint8_t* ptr, int64_t size, int64_t /*alignment*/) {
435 if (ptr == memory_pool::internal::kZeroSizeArea) {

Callers

nothing calls this directly

Calls 2

OutOfMemoryFunction · 0.85
OKFunction · 0.70

Tested by

no test coverage detected