diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-14 17:59:30 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-23 11:41:03 -0500 |
| commit | 7741f7c9ae0b8ff0b22eb60210a72182470740f6 (patch) | |
| tree | 4ee2737cb0187afb841f41d66bb0deca31ebfbec | |
| parent | b01009122151a61d831e8b71434df788b8ceb21f (diff) | |
assert then malloc fails
| -rw-r--r-- | src/memory.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/memory.cpp b/src/memory.cpp index 3f5de65..08df8f0 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -34,6 +34,7 @@ int64_t InitNewBucket(int64_t sz, bool transient = false) { bkt.lastEmptyBlockIndex = -1; bkt.maxBlockCount = blockCount < 10 ? 10 : blockCount; bkt.blocks = reinterpret_cast<char *>(std::malloc(sz)); + assert(bkt.blocks != nullptr && "failed to allocate memory"); bkt.ptr = bkt.blocks + (sizeof(MemBlock) * bkt.maxBlockCount); size_t misalignment = reinterpret_cast<uint64_t>(bkt.ptr) % MAXIMUM_ALIGNMENT; if (misalignment != 0) { |
