| 115 | } |
| 116 | |
| 117 | Status Reallocate(int64_t old_size, int64_t new_size, int64_t /*alignment*/, |
| 118 | uint8_t** ptr) override { |
| 119 | uint8_t* old_ptr = *ptr; |
| 120 | try { |
| 121 | *ptr = alloc_.allocate(new_size); |
| 122 | } catch (std::bad_alloc& e) { |
| 123 | return Status::OutOfMemory(e.what()); |
| 124 | } |
| 125 | memcpy(*ptr, old_ptr, std::min(old_size, new_size)); |
| 126 | alloc_.deallocate(old_ptr, old_size); |
| 127 | stats_.DidReallocateBytes(old_size, new_size); |
| 128 | return Status::OK(); |
| 129 | } |
| 130 | |
| 131 | void Free(uint8_t* buffer, int64_t size, int64_t /*alignment*/) override { |
| 132 | alloc_.deallocate(buffer, size); |
nothing calls this directly
no test coverage detected