NativeMemory.AlignedRealloc(Void*, UIntPtr, UIntPtr) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Important
This API is not CLS-compliant.
Reallocates an aligned block of memory of the specified size and alignment, in bytes.
public:
static void* AlignedRealloc(void* ptr, UIntPtr byteCount, UIntPtr alignment);
[System.CLSCompliant(false)]
public static void* AlignedRealloc (void* ptr, nuint byteCount, nuint alignment);
[System.CLSCompliant(false)]
public static void* AlignedRealloc (void* ptr, UIntPtr byteCount, UIntPtr alignment);
[<System.CLSCompliant(false)>]
static member AlignedRealloc : nativeptr<unit> * unativeint * unativeint -> nativeptr<unit>
Parameters
- ptr
- Void*
The previously allocated block of memory.
- byteCount
-
UIntPtr
nuint
unativeint
The size, in bytes, of the block to allocate.
- alignment
-
UIntPtr
nuint
unativeint
The alignment, in bytes, of the block to allocate. This must be a power of 2
.
Returns
A pointer to the reallocated aligned block of memory.
- Attributes
Exceptions
alignment
is not a power of two.
Reallocating byteCount
of memory with alignment
failed.
Remarks
This method acts as AlignedAlloc(UIntPtr, UIntPtr) if ptr
is null
.
This method allows byteCount
to be 0
and will return a valid pointer that should not be dereferenced and that should be passed to free to avoid memory leaks.
This method is a platform dependent aligned reallocation API such as _aligned_realloc
on Win32.
This method is not compatible with Free(Void*) or Realloc(Void*, UIntPtr). Instead, call AlignedFree(Void*) or AlignedRealloc(Void*, UIntPtr, UIntPtr).
Applies to
Povratne informacije
https://aka.ms/ContentUserFeedback.
Kmalu na voljo: V letu 2024 bomo ukinili storitev Težave v storitvi GitHub kot mehanizem za povratne informacije za vsebino in jo zamenjali z novim sistemom za povratne informacije. Za več informacij si oglejte:Pošlji in prikaži povratne informacije za