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

System.Object
OrtMemoryAllocation

###### Namespace: Microsoft.ML.OnnxRuntime

###### Assembly: cs.temp.dll.dll

##### Syntax

    public class OrtMemoryAllocation : SafeHandle

### Properties

#### Info

Memory Information about this allocation

##### Declaration

    public OrtMemoryInfo Info { get; }

##### Property Value

Type | Description
--- | ---
OrtMemoryInfo | Returns OrtMemoryInfo from the allocator

#### IsInvalid

Overrides SafeHandle.IsInvalid

##### Declaration

    public override bool IsInvalid { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | returns true if handle is equal to Zero

#### Size

Size of the allocation

##### Declaration

    public uint Size { get; }

##### Property Value

Type | Description
--- | ---
System.UInt32 | uint size of the allocation in bytes

### Methods

#### ReleaseHandle()

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

##### Declaration

    protected override bool ReleaseHandle()

##### Returns

Type | Description
--- | ---
System.Boolean | always returns true