Struct AllocatorManager.Block
A block of memory with a Range and metadata for size in bytes of each item in the block, number of allocated items, and alignment.
Namespace: Unity.Collections
Syntax
public struct Block : IDisposable
Fields
AllocatedItems
How many items were actually allocated.
Declaration
public int AllocatedItems
Field Value
Type | Description |
---|---|
Int32 |
BytesPerItem
Number of bytes in each item requested.
Declaration
public int BytesPerItem
Field Value
Type | Description |
---|---|
Int32 |
Log2Alignment
(1 << this) is the byte alignment.
Declaration
public byte Log2Alignment
Field Value
Type | Description |
---|---|
Byte |
Padding0
Unused.
Declaration
public byte Padding0
Field Value
Type | Description |
---|---|
Byte |
Padding1
Unused.
Declaration
public ushort Padding1
Field Value
Type | Description |
---|---|
UInt16 |
Padding2
Unused.
Declaration
public uint Padding2
Field Value
Type | Description |
---|---|
UInt32 |
Range
Declaration
public AllocatorManager.Range Range
Field Value
Type | Description |
---|---|
AllocatorManager.Range |
Properties
Alignment
Compute and return the alignment
Declaration
public int Alignment { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
AllocatedBytes
Compute and return the total number of bytes already allocated.
Declaration
public long AllocatedBytes { get; }
Property Value
Type | Description |
---|---|
Int64 |
Bytes
Compute and return the total number of bytes required.
Declaration
public long Bytes { get; }
Property Value
Type | Description |
---|---|
Int64 |
Methods
Allocate()
Allocate the block, throwing if not successful when checks are enabled
Declaration
public void Allocate()
Dispose()
Dispose the memory block
Declaration
public void Dispose()
Free()
Free the block, throwing if not successful when checks are enabled
Declaration
public void Free()
TryAllocate()
Attempt to allocate the block
Declaration
public int TryAllocate()
Returns
Type | Description |
---|---|
Int32 | An error code |
TryFree()
Attempt to free the block
Declaration
public int TryFree()
Returns
Type | Description |
---|---|
Int32 | An error code |