| 52 | } |
| 53 | |
| 54 | std::span<uint8_t> MemoryManager::mallocBuffer(bool initializeToZero, uint64_t size) { |
| 55 | if (!bm->reserve(size)) { |
| 56 | throw BufferManagerException( |
| 57 | "Unable to allocate memory! The buffer pool is full and no memory could be freed!"); |
| 58 | } |
| 59 | void* buffer = nullptr; |
| 60 | bm->nonEvictableMemory += size; |
| 61 | if (initializeToZero) { |
| 62 | buffer = calloc(size, 1); |
| 63 | } else { |
| 64 | buffer = malloc(size); |
| 65 | } |
| 66 | return std::span(static_cast<uint8_t*>(buffer), size); |
| 67 | } |
| 68 | |
| 69 | std::unique_ptr<MemoryBuffer> MemoryManager::allocateBuffer(bool initializeToZero, uint64_t size) { |
| 70 | if (size != TEMP_PAGE_SIZE) [[unlikely]] { |
no test coverage detected