Skip to content

Commit ae10c29

Browse files
committed
make documentation of UMRBP.allocate() more complete.
1 parent 7f68d6a commit ae10c29

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,19 @@ extension Unsafe${Mutable}RawBufferPointer: RandomAccessCollection { }
263263

264264
extension Unsafe${Mutable}RawBufferPointer {
265265
% if mutable:
266-
/// Returns a newly allocated buffer with the given size, in bytes.
266+
/// Allocates uninitialized memory with the specified size and alignment.
267267
///
268-
/// The memory referenced by the new buffer is allocated, but not
269-
/// initialized.
268+
/// You are in charge of managing the allocated memory. Be sure to deallocate
269+
/// any memory that you manually allocate.
270+
///
271+
/// The allocated memory is not bound to any specific type and must be bound
272+
/// before performing any typed operations. If you are using the memory for
273+
/// a specific type, allocate memory using the
274+
/// `UnsafeMutablePointerBuffer.allocate(capacity:)` static method instead.
270275
///
271276
/// - Parameters:
272-
/// - byteCount: The number of bytes to allocate.
277+
/// - byteCount: The number of bytes to allocate. `byteCount` must not be
278+
/// negative.
273279
/// - alignment: The alignment of the new region of allocated memory, in
274280
/// bytes. `alignment` must be a whole power of 2.
275281
/// - Returns: A buffer pointer to a newly allocated region of memory aligned

0 commit comments

Comments
 (0)