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

Method ReallocateAligned

cpp/src/arrow/memory_pool.cc:408–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

arrow_mi_realloc_alignedFunction · 0.85
OutOfMemoryFunction · 0.85
OKFunction · 0.70

Tested by

no test coverage detected