Skip to content

swift_allocObject(for_size_alignment_)

tevelee edited this page Jul 21, 2026 · 1 revision

swift_allocObject(for:size:alignment:)

Allocates a new reference counted class instance.

public func swift_allocObject(
  for type: ClassMetadata,
  size: Int,
  alignment: Int
) -> UnsafeRawPointer 

Parameters

  • type: The class metadata to allocate an instance for.

Returns

A pointer to the heap object. This is intentionally left raw because there is almost always more initialization that needs to happen after allocation.

Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally