System.Runtime.InteropServices.Marshal.ReAllocCoTaskMem Method

Resizes a block of memory previously allocated with Marshal.AllocCoTaskMem(int).

Syntax

public static IntPtr ReAllocCoTaskMem (IntPtr pv, int cb)

Parameters

pv
A pointer to memory allocated with Marshal.AllocCoTaskMem(int).
cb
The new size of the allocated block.

Returns

An integer representing the address of the reallocated block of memory. This memory must be released with Marshal.FreeCoTaskMem(IntPtr).

Remarks

Marshal.ReAllocCoTaskMem(IntPtr, int) is one of two memory reallocation methods in the System.Runtime.InteropServices.Marshal class. (Marshal.ReAllocHGlobal(IntPtr, IntPtr) is the other.) The beginning of the reallocated memory content is the same as the original content; however, the entire memory block can be in a different location. This method exposes the COM tp://go.microsoft.com/fwlink/?LinkId=148778 function, which is referred to as the COM task memory allocator.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0