| 125 | } |
| 126 | |
| 127 | Status Reallocate(int64_t old_size, int64_t new_size, int64_t /*alignment*/, |
| 128 | uint8_t** ptr) override { |
| 129 | uint8_t* old_ptr = *ptr; |
| 130 | try { |
| 131 | *ptr = alloc_.allocate(new_size); |
| 132 | } catch (std::bad_alloc& e) { |
| 133 | return Status::OutOfMemory(e.what()); |
| 134 | } |
| 135 | memcpy(*ptr, old_ptr, std::min(old_size, new_size)); |
| 136 | alloc_.deallocate(old_ptr, old_size); |
| 137 | stats_.DidReallocateBytes(old_size, new_size); |
| 138 | return Status::OK(); |
| 139 | } |
| 140 | |
| 141 | void Free(uint8_t* buffer, int64_t size, int64_t /*alignment*/) override { |
| 142 | alloc_.deallocate(buffer, size); |
nothing calls this directly
no test coverage detected