Show / Hide Table of Contents

Class UnmanagedMemory

Represents unstructured unmanaged memory.

Inheritance
Object
UnmanagedMemoryHandle
UnmanagedMemory
Implements
ICloneable
IEquatable<UnmanagedMemoryHandle>
IUnmanagedMemory
IDisposable
Inherited Members
UnmanagedMemoryHandle.IsInvalid
UnmanagedMemoryHandle.Clear()
UnmanagedMemoryHandle.ReleaseHandle()
UnmanagedMemoryHandle.Pointer
UnmanagedMemoryHandle.Bytes
UnmanagedMemoryHandle.AsStream()
UnmanagedMemoryHandle.ToByteArray()
UnmanagedMemoryHandle.WriteTo(Stream)
UnmanagedMemoryHandle.ReadFrom(Stream)
UnmanagedMemoryHandle.WriteToAsync(Stream)
UnmanagedMemoryHandle.ReadFromAsync(Stream)
UnmanagedMemoryHandle.WriteTo(Pointer<Byte>)
UnmanagedMemoryHandle.ReadFrom(Pointer<Byte>)
UnmanagedMemoryHandle.WriteTo(UnmanagedMemoryHandle)
UnmanagedMemoryHandle.BitwiseEquals(UnmanagedMemoryHandle)
UnmanagedMemoryHandle.BitwiseCompare(UnmanagedMemoryHandle)
UnmanagedMemoryHandle.Equals(UnmanagedMemoryHandle)
UnmanagedMemoryHandle.Equals(Object)
UnmanagedMemoryHandle.ToString()
UnmanagedMemoryHandle.GetHashCode()
Namespace: DotNext.Runtime.InteropServices
Assembly: DotNext.Unsafe.dll
Syntax
public sealed class UnmanagedMemory : UnmanagedMemoryHandle, ICloneable, IEquatable<UnmanagedMemoryHandle>, IUnmanagedMemory, IDisposable

Constructors

| Improve this Doc View Source

UnmanagedMemory(Int64, Boolean)

Allocates the block of unmanaged memory.

Declaration
public UnmanagedMemory(long size, bool zeroMem = true)
Parameters
Type Name Description
Int64 size

The size of unmanaged memory to be allocated, in bytes.

Boolean zeroMem

Sets all bytes of allocated memory to zero.

Properties

| Improve this Doc View Source

Size

Gets size of allocated unmanaged memory, in bytes.

Declaration
public override long Size { get; }
Property Value
Type Description
Int64
Overrides
UnmanagedMemoryHandle.Size

Methods

| Improve this Doc View Source

Copy()

Creates bitwise copy of the unmanaged memory.

Declaration
public UnmanagedMemory Copy()
Returns
Type Description
UnmanagedMemory

The independent copy of unmanaged memory.

| Improve this Doc View Source

ReadFrom(Byte[])

Copies bytes from the memory location to the managed array.

Declaration
public long ReadFrom(byte[] source)
Parameters
Type Name Description
Byte[] source

The source array.

Returns
Type Description
Int64

The actual number of copied bytes.

| Improve this Doc View Source

ReadFrom(Byte[], Int64, Int64)

Copies bytes from the specified array into the memory block identified by this object.

Declaration
public long ReadFrom(byte[] source, long offset, long count)
Parameters
Type Name Description
Byte[] source

The source array.

Int64 offset

The position in the source array from which copying begins.

Int64 count

The number of bytes to be copied.

Returns
Type Description
Int64

Actual number of copied bytes.

| Improve this Doc View Source

Reallocate(Int64)

Resizes a block of memory represented by this instance.

Declaration
public void Reallocate(long size)
Parameters
Type Name Description
Int64 size

The new number of bytes in the unmanaged array.

| Improve this Doc View Source

WriteTo(Byte[])

Copies bytes from the memory location to the managed array.

Declaration
public long WriteTo(byte[] destination)
Parameters
Type Name Description
Byte[] destination

The destination array.

Returns
Type Description
Int64

The actual number of copied bytes.

| Improve this Doc View Source

WriteTo(Byte[], Int64, Int64)

Copies bytes from the memory location to the managed array.

Declaration
public long WriteTo(byte[] destination, long offset, long count)
Parameters
Type Name Description
Byte[] destination

The destination array.

Int64 offset

The position in the destination array from which copying begins.

Int64 count

The number of bytes to be copied.

Returns
Type Description
Int64

The actual number of copied bytes.

Operators

| Improve this Doc View Source

Implicit(UnmanagedMemory to Pointer<Byte>)

Gets a pointer to the allocated unmanaged memory.

Declaration
public static implicit operator Pointer<byte>(UnmanagedMemory owner)
Parameters
Type Name Description
UnmanagedMemory owner

The owner of allocated unmanaged memory.

Returns
Type Description
Pointer<Byte>
| Improve this Doc View Source

Implicit(UnmanagedMemory to Span<Byte>)

Gets a span from the specified instance.

Declaration
public static implicit operator Span<byte>(UnmanagedMemory owner)
Parameters
Type Name Description
UnmanagedMemory owner

The owner of allocated unmanaged memory.

Returns
Type Description
Span<Byte>

Implements

ICloneable
IEquatable<>
IUnmanagedMemory
IDisposable

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ExpressionBuilder.Const<T>(T)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, R1, R2>(T, Func<T, R1>, Func<T, R2>, out R1, out R2)
ObjectExtensions.Decompose<T, R1, R2>(T, ValueFunc<T, R1>, ValueFunc<T, R2>, out R1, out R2)
ObjectExtensions.Decompose<T, R1, R2>(T, Func<T, R1>, Func<T, R2>)
ObjectExtensions.Decompose<T, R1, R2>(T, ValueFunc<T, R1>, ValueFunc<T, R2>)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX