GetSharedAllocator property

Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtEnv> env, Pointer<OrtMemoryInfo> mem_info, Pointer<Pointer<OrtAllocator>> allocator)>> GetSharedAllocator
getter/setter pair

\brief Get a shared allocator from the OrtEnv.

By default there is a shared allocator created for all OrtEpDevice instances, so if you get the OrtMemoryInfo from the OrtEpDevice using EpDevice_MemoryInfo a shared allocator is guaranteed to exist.

This will also match and return custom allocators added with RegisterAllocator.

It is not an error to not find a matching allocator.

\paramin env The OrtEnv instance to get the shared allocator from. \paramin mem_info The OrtMemoryInfo instance to get the shared allocator for. \paramout allocator A pointer to the shared allocator, or nullptr if no shared allocator exists for the given memory info.

\snippet{doc} snippets.dox OrtStatus Return Value

\since Version 1.23

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtEnv> env,
      ffi.Pointer<OrtMemoryInfo> mem_info,
      ffi.Pointer<ffi.Pointer<OrtAllocator>> allocator,
    )
  >
>
GetSharedAllocator;