static class · System.Runtime.InteropServices
NativeMemory
public static class NativeMemory
Native memory blocks (not seen by the collector).
- Tipo
- static class
- Espacio de nombres
- System.Runtime.InteropServices
- Ensamblado
- System.Core
- Acceso
- public, static, abstract
- Archivo fuente
Interop.ant
Herencia
- Clases base
-
AnyNativeMemory
Métodos
bytes of native memory, zeroed (Free gives it back).
count elements of size bytes, zeroed.
unsafe Free(void* block)
#
Copies bytes bytes from source to destination (the blocks do not overlap).
Sets bytes bytes at block to value.
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
NativeMemory en Antril, descompilado a partir de su Larva HIR.
// System.Runtime.InteropServices.NativeMemory — System.Core (decompiled from Larva HIR)
into namespace System.Runtime.InteropServices
{
/// Native memory blocks (not seen by the collector).
public static class NativeMemory
{
public:
/// `bytes` of native memory, zeroed (Free gives it back).
unsafe Alloc(u64 bytes) : void* => (void*)CStrings.Allocate((i64)bytes);
/// `count` elements of `size` bytes, zeroed.
unsafe AllocZeroed(u64 count, u64 size) : void* => (void*)CStrings.Allocate((i64)(count * size));
unsafe Free(void* block)
{
CStrings.Release((u8*)block);
}
/// Copies `bytes` bytes from `source` to `destination` (the blocks do not overlap).
unsafe Copy(void* source, void* destination, u64 bytes)
{
u8* from = (u8*)source;
u8* to = (u8*)destination;
loop (u64 i = 0; i < bytes; i++)
*(to + (i64)i) = *(from + (i64)i);
}
/// Sets `bytes` bytes at `block` to `value`.
unsafe Fill(void* block, u64 bytes, u8 value)
{
u8* at = (u8*)block;
loop (u64 i = 0; i < bytes; i++)
*(at + (i64)i) = value;
}
unsafe Clear(void* block, u64 bytes)
{
Fill(block, bytes, 0);
}
}
}