Allocator interface

The allocator interface is currently considered experimental and not part of the public API.

AllocArrays.Allocator — Type
abstract type Allocator end

Allocators need to subtype Allocator and implement two methods of alloc_similar:

  • AllocArrays.alloc_similar(::MyAllocator, a::AllocArray, ::Type{T}, dims::Dims)
  • AllocArrays.alloc_similar(::MyAllocator, ::Type{<:AllocArray{T}}, dims::Dims) where {T}

to support AllocArrays, (which should each return an AllocArray) and likewise

  • AllocArrays.alloc_similar(::MyAllocator, a::CheckedAllocArray, ::Type{T}, dims::Dims)
  • AllocArrays.alloc_similar(::MyAllocator, ::Type{<:CheckedAllocArray{T}}, dims::Dims) where {T}

which should each return a CheckedAllocArray.

source