NativeMemory.Realloc(Void*, 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 a block of memory to be the specified size, in bytes.
public:
static void* Realloc(void* ptr, UIntPtr byteCount);
[System.CLSCompliant(false)]
public static void* Realloc (void* ptr, nuint byteCount);
[System.CLSCompliant(false)]
public static void* Realloc (void* ptr, UIntPtr byteCount);
[<System.CLSCompliant(false)>]
static member Realloc : nativeptr<unit> * unativeint -> nativeptr<unit>
Parameters
- ptr
- Void*
The previously allocated block of memory.
- byteCount
-
UIntPtr
nuint
unativeint
The size, in bytes, of the reallocated block.
Returns
A pointer to the reallocated block of memory.
- Attributes
Exceptions
Reallocating byteCount
of memory failed.
Remarks
This method acts as Alloc(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 thin wrapper over the C realloc
API.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om