Struct VirtualMemoryUtility
Namespace: Unity.Collections.LowLevel.Unsafe
Syntax
public struct VirtualMemoryUtility
Properties
DefaultPageSizeInBytes
Gets the default virtual memory page size in bytes for this platform.
Declaration
public static uint DefaultPageSizeInBytes { get; }
Property Value
Type | Description |
---|---|
UInt32 |
Methods
BytesToPageCount(UInt32, UInt32)
Computes the number of pages required to cover a contiguous area of memory.
Declaration
public static uint BytesToPageCount(uint bytes, uint pageSizeInBytes)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | bytes | Bytes of the contiguous area of memory. |
UInt32 | pageSizeInBytes | Size of the virtual memory page in bytes. |
Returns
Type | Description |
---|---|
UInt32 | The page count required to cover the contiguous area of memory. |
CommitMemory(VMRange, out BaselibErrorState)
Commits memory from reserved address space.
Declaration
public static void CommitMemory(VMRange rangeToCommit, out BaselibErrorState outErrorState)
Parameters
Type | Name | Description |
---|---|---|
VMRange | rangeToCommit | Reserved virtual address range from which to allocate memory. |
BaselibErrorState | outErrorState | Wrapped copy of Baselib_ErrorState. |
DecommitMemory(VMRange, out BaselibErrorState)
Decommits committed memory from reserved address space.
Declaration
public static void DecommitMemory(VMRange rangeToFree, out BaselibErrorState outErrorState)
Parameters
Type | Name | Description |
---|---|---|
VMRange | rangeToFree | Virtual address range from which to free allocated memory. |
BaselibErrorState | outErrorState | Wrapped copy of Baselib_ErrorState. |
FreeAddressSpace(VMRange, out BaselibErrorState)
Frees reserved address space.
Declaration
public static void FreeAddressSpace(VMRange reservedAddressRange, out BaselibErrorState outErrorState)
Parameters
Type | Name | Description |
---|---|---|
VMRange | reservedAddressRange | Virtual address range to release. |
BaselibErrorState | outErrorState | Wrapped copy of Baselib_ErrorState. |
ReportWrappedBaselibError(BaselibErrorState)
Logs baselib errors to the console.
Declaration
public static void ReportWrappedBaselibError(BaselibErrorState wrappedErrorState)
Parameters
Type | Name | Description |
---|---|---|
BaselibErrorState | wrappedErrorState | Wrapped copy of Baselib_ErrorState. |
ReserveAddressSpace(UInt64, UInt64, out BaselibErrorState)
Reserves a contiguous range of address space.
Declaration
public static VMRange ReserveAddressSpace(ulong sizeOfAddressRangeInPages, ulong pageSizeInBytes, out BaselibErrorState outErrorState)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | sizeOfAddressRangeInPages | Size of a virtual address range to reserve, in pages. |
UInt64 | pageSizeInBytes | Size of a page of virtual memory, in bytes. |
BaselibErrorState | outErrorState | Wrapped copy of Baselib_ErrorState. |
Returns
Type | Description |
---|---|
VMRange | A VMRange. Upon failure, the returned VMRange will have a null pointer, 0 sized pages, and 0 page count. |