| 97 | } |
| 98 | |
| 99 | Status 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 | |
| 121 | void JemallocAllocator::DeallocateAligned(uint8_t* ptr, int64_t size, int64_t alignment) { |
| 122 | if (ptr == kZeroSizeArea) { |
nothing calls this directly
no test coverage detected