RegisterAllocator property

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

\brief Register a custom allocator

Enables sharing between multiple sessions that use the same env instance. Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.

The behavior of this is exactly the same as OrtApi::CreateAndRegisterAllocator except instead of ORT creating an allocator based on provided info, in this case ORT uses the user-provided custom allocator. See https://onnxruntime.ai/docs/get-started/with-c.html for details.

\paramin env \paramin allocator User provided allocator

\snippet{doc} snippets.dox OrtStatus Return Value

Implementation

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