Skip to content

Commit a25f72b

Browse files
Attempt to clarify the deallocation rules for UMBP. (#85101)
resolves rdar://162944521 --------- Co-authored-by: Guillaume Lessard <glessard@tffenterprises.com>
1 parent 5494a24 commit a25f72b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/public/core/UnsafePointer.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,10 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
788788
///
789789
/// intPointer.deallocate()
790790
///
791+
/// You must only use `deallocate()` to end the lifetime of memory
792+
/// created with `allocate()`; it is a programming error to use `free` or
793+
/// another deallocation API, and may result in undefined behavior.
794+
///
791795
/// - Parameter count: The amount of memory to allocate, counted in instances
792796
/// of `Pointee`.
793797
@inlinable

0 commit comments

Comments
 (0)