| 459 | ~BaseMemoryPoolImpl() override {} |
| 460 | |
| 461 | Status Allocate(int64_t size, int64_t alignment, uint8_t** out) override { |
| 462 | if (size < 0) { |
| 463 | return Status::Invalid("negative malloc size"); |
| 464 | } |
| 465 | if (static_cast<uint64_t>(size) >= std::numeric_limits<size_t>::max()) { |
| 466 | return Status::OutOfMemory("malloc size overflows size_t"); |
| 467 | } |
| 468 | RETURN_NOT_OK(Allocator::AllocateAligned(size, alignment, out)); |
| 469 | #ifndef NDEBUG |
| 470 | // Poison data |
| 471 | if (size > 0) { |
| 472 | DCHECK_NE(*out, nullptr); |
| 473 | (*out)[0] = kAllocPoison; |
| 474 | (*out)[size - 1] = kAllocPoison; |
| 475 | } |
| 476 | #endif |
| 477 | |
| 478 | stats_.DidAllocateBytes(size); |
| 479 | return Status::OK(); |
| 480 | } |
| 481 | |
| 482 | Status Reallocate(int64_t old_size, int64_t new_size, int64_t alignment, |
| 483 | uint8_t** ptr) override { |
nothing calls this directly
no test coverage detected