GetStats property

Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtAllocator> this_, Pointer<Pointer<OrtKeyValuePairs>> out)>> GetStats
getter/setter pair

@brief Function used to get the statistics of the allocator.

Return a pointer to the OrtKeyValuePairs structure that contains the statistics of the allocator. The user should call OrtApi::ReleaseKeyValuePairs when done.

Current known keys are:

  • Limit: Bytes limit of the allocator. -1 if no limit is set.
  • InUse: Number of bytes in use.
  • TotalAllocated: The total number of allocated bytes by the allocator.
  • MaxInUse: The maximum bytes in use.
  • NumAllocs: Number of allocations.
  • NumReserves: Number of reserves. (Number of calls to Reserve() in arena-based allocators)
  • NumArenaExtensions: Number of arena extensions (Relevant only for arena based allocators)
  • NumArenaShrinkages: Number of arena shrinkages (Relevant only for arena based allocators)
  • MaxAllocSize: The max single allocation seen.

The allocator is free to add other entries as appropriate.

\note Implementation of this function is optional and GetStats may be set to a nullptr. If the OrtAllocator is wrapping an internal ORT allocator that does not implement GetStats the returned OrtKeyValuePairs instance will be empty.

\since 1.23

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtAllocator> this_,
      ffi.Pointer<ffi.Pointer<OrtKeyValuePairs>> out,
    )
  >
>
GetStats;