Class ExNativeMemory
This class contains methods that are mainly used to manage native memory. It can enable early versions NET can also use the method of NativeMemory, which will revert back to the implementation of AllocHGlobal(nint) (此类包含了主要用于管理本机内存的方法. 它能使早期版本的 .NET 也能使用 NativeMemory 的方法, 此时会回退为 AllocHGlobal(nint) 的实现).
public static class ExNativeMemory
- Inheritance
-
ExNativeMemory
- Inherited Members
Methods
- Alloc(nuint)
Allocates a block of memory of the specified size, in bytes (分配指定大小的内存块(以字节为单位)).
- Alloc(nuint, nuint)
Allocates a block of memory of the specified size, in elements (按元素分配指定大小的内存块).
- AllocZeroed(nuint)
Allocates and zeroes a block of memory of the specified size, in bytes (分配并清零指定大小的内存块(以字节为单位)).
- AllocZeroed(nuint, nuint)
Allocates and zeroes a block of memory of the specified size, in elements (按元素分配并清零指定大小的内存块).
- Clear(void*, nuint)
Clears a block of memory (清零内存块).
- Copy(void*, void*, nuint)
Copies a block of memory from memory location
source
to memory locationdestination
(将内存块从内存位置 source 复制到内存位置 destination).
- Fill(void*, nuint, byte)
Copies the byte
value
to the firstbyteCount
bytes of the memory located atptr
(将字节value复制到 ptr处起始、byteCount字节的内存块).
- Free(void*)
Frees a block of memory (释放内存块).
- Realloc(void*, nuint)
Reallocates a block of memory to be the specified size, in bytes (将内存块重新分配为指定大小(以字节为单位).