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

Method ReallocateAligned

cpp/src/arrow/memory_pool_jemalloc.cc:99–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99Status JemallocAllocator::ReallocateAligned(int64_t old_size, int64_t new_size,
100 int64_t alignment, uint8_t** ptr) {
101 uint8_t* previous_ptr = *ptr;
102 if (previous_ptr == kZeroSizeArea) {
103 DCHECK_EQ(old_size, 0);
104 return AllocateAligned(new_size, alignment, ptr);
105 }
106 if (new_size == 0) {
107 DeallocateAligned(previous_ptr, old_size, alignment);
108 *ptr = kZeroSizeArea;
109 return Status::OK();
110 }
111 *ptr =
112 reinterpret_cast<uint8_t*>(rallocx(*ptr, static_cast<size_t>(new_size),
113 MALLOCX_ALIGN(static_cast<size_t>(alignment))));
114 if (*ptr == NULL) {
115 *ptr = previous_ptr;
116 return Status::OutOfMemory("realloc of size ", new_size, " failed");
117 }
118 return Status::OK();
119}
120
121void JemallocAllocator::DeallocateAligned(uint8_t* ptr, int64_t size, int64_t alignment) {
122 if (ptr == kZeroSizeArea) {

Callers

nothing calls this directly

Calls 2

OutOfMemoryFunction · 0.85
OKFunction · 0.70

Tested by

no test coverage detected