NativeMemory.AllocZeroed Metod

Definition

Överlagringar

Name Description
AllocZeroed(UIntPtr)

Allokerar och nollar ett minnesblock av den angivna storleken, i byte.

AllocZeroed(UIntPtr, UIntPtr)

Allokerar och nollar ett minnesblock av den angivna storleken, i element.

AllocZeroed(UIntPtr)

Källa:
NativeMemory.cs
Källa:
NativeMemory.cs
Källa:
NativeMemory.cs
Källa:
NativeMemory.cs
Källa:
NativeMemory.cs

Viktigt!

Detta API uppfyller inte CLS.

Allokerar och nollar ett minnesblock av den angivna storleken, i byte.

public:
 static void* AllocZeroed(UIntPtr byteCount);
[System.CLSCompliant(false)]
public static void* AllocZeroed(UIntPtr byteCount);
[System.CLSCompliant(false)]
public static void* AllocZeroed(nuint byteCount);
[<System.CLSCompliant(false)>]
static member AllocZeroed : unativeint -> nativeptr<unit>

Parametrar

byteCount
UIntPtr

nuint

unativeint

Storleken, i byte, på blocket som ska allokeras.

Returer

Void*

En pekare till det allokerade och nollade minnesblocket.

Attribut

Undantag

Det gick inte att allokera byteCount minne.

Kommentarer

Den här metoden tillåter byteCount att vara 0 och returnerar en giltig pekare som inte ska avrefereras och som ska skickas utan kostnad för att undvika minnesläckor.

Den här metoden är en tunn omslutning över C-API calloc :et.

Gäller för

AllocZeroed(UIntPtr, UIntPtr)

Källa:
NativeMemory.Unix.cs
Källa:
NativeMemory.Unix.cs
Källa:
NativeMemory.Unix.cs
Källa:
NativeMemory.Unix.cs
Källa:
NativeMemory.Unix.cs

Viktigt!

Detta API uppfyller inte CLS.

Allokerar och nollar ett minnesblock av den angivna storleken, i element.

public:
 static void* AllocZeroed(UIntPtr elementCount, UIntPtr elementSize);
[System.CLSCompliant(false)]
public static void* AllocZeroed(UIntPtr elementCount, UIntPtr elementSize);
[System.CLSCompliant(false)]
public static void* AllocZeroed(nuint elementCount, nuint elementSize);
[<System.CLSCompliant(false)>]
static member AllocZeroed : unativeint * unativeint -> nativeptr<unit>

Parametrar

elementCount
UIntPtr

nuint

unativeint

Antalet, i element, för blocket som ska allokeras.

elementSize
UIntPtr

nuint

unativeint

Storleken i byte för varje element i allokeringen.

Returer

Void*

En pekare till det allokerade och nollade minnesblocket.

Attribut

Undantag

Det gick inte att allokera elementCount * elementSize byte minne.

Kommentarer

Den här metoden tillåter elementCount och elementSize kan vara 0. Den returnerar en giltig pekare som inte ska derefereras och som ska skickas utan kostnad för att undvika minnesläckor.

Den här metoden är en tunn omslutning över C-API calloc :et.

Gäller för