| 55 | } |
| 56 | |
| 57 | void TestOOM() { |
| 58 | auto pool = memory_pool(); |
| 59 | |
| 60 | uint8_t* data; |
| 61 | int64_t max_alloc = std::min<uint64_t>(std::numeric_limits<int64_t>::max(), |
| 62 | std::numeric_limits<size_t>::max()); |
| 63 | // subtract 63 to prevent overflow after the size is aligned |
| 64 | for (int64_t to_alloc : {max_alloc, max_alloc - 63, max_alloc - 127}) { |
| 65 | ASSERT_RAISES(OutOfMemory, pool->Allocate(to_alloc, &data)); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void TestReallocate() { |
| 70 | auto pool = memory_pool(); |
no test coverage detected