createCpuMemoryInfo method

Pointer<OrtMemoryInfo> createCpuMemoryInfo()

Implementation

Pointer<OrtMemoryInfo> createCpuMemoryInfo() {
  _runtime.ensureInitialized();
  final api = _runtime.api.ref;
  final memInfoPtr = calloc<Pointer<OrtMemoryInfo>>();
  try {
    final status = api.CreateCpuMemoryInfo
        .asFunction<
          Pointer<OrtStatus> Function(
            int type,
            int memType,
            Pointer<Pointer<OrtMemoryInfo>>,
          )
        >()(
          OrtAllocatorType.OrtArenaAllocator.value,
          OrtMemType.OrtMemTypeDefault.value,
          memInfoPtr,
        );
    _checkStatus(status);
    return memInfoPtr.value;
  } finally {
    calloc.free(memInfoPtr);
  }
}