Skip to main content



Atomic reference-counted pointer.

This smart pointer owns an instance of T indirectly managed on the heap. This pointer is copyable, including across threads, maintaining a reference count to the underlying data.

This pointer itself is thread-safe using atomic accesses to reference count the underlying data, but references returned to the underlying data are not thread safe.


  • T (Movable): The type of the stored value.

Implemented traits

AnyType, CollectionElement, Copyable, Movable



__init__(inout self: Self, owned value: T)

Construct a new thread-safe, reference-counted smart pointer, and move the value into heap memory managed by the new pointer.


  • value (T): The value to manage.


__copyinit__(inout self: Self, existing: Self)

Copy an existing reference. Increment the refcount to the object.


  • existing (Self): The existing reference.


__del__(owned self: Self)

Delete the smart pointer reference.

Decrement the ref count for the reference. If there are no more references, delete the object and free its memory.


__getitem__(self: Reference[Arc[T], is_mutable, lifetime, 0]) -> ref [$1] T

Returns a Reference to the managed value.


A Reference to the managed value.


as_ptr(self: Self) -> UnsafePointer[T, 0]

Retrieves a pointer to the underlying memory.


The UnsafePointer to the underlying memory.