We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 36b41d4 + adec767 commit c684c56Copy full SHA for c684c56
stdlib/public/runtime/StackAllocator.h
@@ -283,7 +283,10 @@ class StackAllocator {
283
numAllocatedSlabs(0) {}
284
285
/// Construct a StackAllocator with a pre-allocated first slab.
286
- StackAllocator(void *firstSlabBuffer, size_t bufferCapacity) {
+ StackAllocator(void *firstSlabBuffer, size_t bufferCapacity) : StackAllocator() {
287
+ // If the pre-allocated buffer can't hold a slab header, ignore it.
288
+ if (bufferCapacity <= Slab::headerSize())
289
+ return;
290
char *start = (char *)llvm::alignAddr(firstSlabBuffer,
291
llvm::Align(alignment));
292
char *end = (char *)firstSlabBuffer + bufferCapacity;
0 commit comments