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.