Show / Hide Table of Contents

Class OrtMemoryAllocation

This class represents memory allocation made by a specific onnxruntime allocator. Use OrtAllocator.Allocate() to obtain an instance of this class. It implements IDisposable and makes use of the original allocator used to allocate the memory. The lifespan of the allocator instance must eclipse the lifespan of the allocation. Or, if you prefer, all OrtMemoryAllocation instances must be disposed of before the corresponding allocator instances are disposed of.

Inheritance
Object
CriticalFinalizerObject
SafeHandle
OrtMemoryAllocation
Implements
IDisposable
Inherited Members
SafeHandle.handle
SafeHandle.Close()
SafeHandle.DangerousAddRef(Boolean)
SafeHandle.DangerousGetHandle()
SafeHandle.DangerousRelease()
SafeHandle.Dispose()
SafeHandle.Dispose(Boolean)
SafeHandle.SetHandle(IntPtr)
SafeHandle.SetHandleAsInvalid()
SafeHandle.IsClosed
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Microsoft.ML.OnnxRuntime
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
public class OrtMemoryAllocation : SafeHandle, IDisposable

Properties

| Improve this Doc View Source

Info

Memory Information about this allocation

Declaration
public OrtMemoryInfo Info { get; }
Property Value
Type Description
OrtMemoryInfo

Returns OrtMemoryInfo from the allocator

| Improve this Doc View Source

IsInvalid

Overrides SafeHandle.IsInvalid

Declaration
public override bool IsInvalid { get; }
Property Value
Type Description
Boolean

returns true if handle is equal to Zero

Overrides
System.Runtime.InteropServices.SafeHandle.IsInvalid
| Improve this Doc View Source

Size

Size of the allocation

Declaration
public uint Size { get; }
Property Value
Type Description
UInt32

uint size of the allocation in bytes

Methods

| Improve this Doc View Source

ReleaseHandle()

Overrides SafeHandle.ReleaseHandle() to deallocate a chunk of memory using the specified allocator.

Declaration
protected override bool ReleaseHandle()
Returns
Type Description
Boolean

always returns true

Overrides
System.Runtime.InteropServices.SafeHandle.ReleaseHandle()

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top