Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stdlib/public/core/UnsafePointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,10 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
///
/// intPointer.deallocate()
///
/// You must only use `deallocate()` to end the lifetime of memory
/// created with `allocate()`; it is a programming error to use `free` or
Copy link
Contributor

@glessard glessard Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call out free() explicitly, or should we say "other deallocation functions", or maybe "deallocation functions from other libraries"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was torn on this. But I feel like free is the primary means of abuse, and anyone who was going to use anything else that they shouldn't will understand that the rules for free apply to them as well.

/// another deallocation API, and may result in undefined behavior.
///
/// - Parameter count: The amount of memory to allocate, counted in instances
/// of `Pointee`.
@inlinable
Expand Down