Skip to content

Commit 8dfab14

Browse files
committed
[SwiftSyntax] Enhance clarity in the conditions for allocating a custom slab
1 parent 07f3e06 commit 8dfab14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/SwiftSyntax/BumpPtrAllocator.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ public class BumpPtrAllocator {
111111
return allocated
112112
}
113113

114-
// If the size is too big, allocate a dedicated slab for it.
115-
if byteCount >= self.initialSlabSize {
114+
// If the size is too large to be contained in the new slab,
115+
// allocate a dedicated slab for it.
116+
if byteCount > self.slabSize(at: slabs.count) {
116117
let customSlab = Slab.allocate(
117118
byteCount: byteCount,
118119
alignment: alignment

0 commit comments

Comments
 (0)