Método Marshal.ReAllocHGlobal (IntPtr, IntPtr)
Cambia el tamaño de un bloque de memoria asignado previamente con AllocHGlobal.
Espacio de nombres: System.Runtime.InteropServices
Ensamblado: mscorlib (en mscorlib.dll)
Sintaxis
[SecurityCriticalAttribute]
public static IntPtr ReAllocHGlobal(
IntPtr pv,
IntPtr cb
)
public:
[SecurityCriticalAttribute]
static IntPtr ReAllocHGlobal(
IntPtr pv,
IntPtr cb
)
[<SecurityCriticalAttribute>]
static member ReAllocHGlobal :
pv:nativeint *
cb:nativeint -> nativeint
<SecurityCriticalAttribute>
Public Shared Function ReAllocHGlobal (
pv As IntPtr,
cb As IntPtr
) As IntPtr
Parámetros
pv
Type: System.IntPtrPuntero a memoria asignada con AllocHGlobal.
cb
Type: System.IntPtrNuevo tamaño del bloque asignado. Esto no es un puntero; es el recuento de bytes que está solicitando, convertido al tipo IntPtr. Si pasa un puntero, se trata como un tamaño.
Valor devuelto
Type: System.IntPtr
Puntero a la memoria reasignada. Esta memoria debe liberarse mediante Marshal.FreeHGlobal.
Excepciones
Exception | Condition |
---|---|
OutOfMemoryException | No hay memoria suficiente para satisfacer la solicitud. |
Comentarios
ReAllocHGlobal is one of two memory reallocation API methods in the Marshal class. (Marshal.ReAllocCoTaskMem is the other.)
This method exposes the Win32 GlobalReAllochttps://go.microsoft.com/fwlink/?LinkId=148780 function from Kernel32.dll. The returned pointer can differ from the original. If it is different, the contents of the original memory block have been copied to the new block, and the original memory block has been freed.
Seguridad
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Información de versión
Plataforma universal de Windows
Disponible desde 8
.NET Framework
Disponible desde 1.1
Biblioteca de clases portable
Se admite en: plataformas portátiles de .NET
Windows Phone
Disponible desde 8.1
Ver también
ReAllocCoTaskMem
FreeHGlobal
Clase Marshal
Espacio de nombres System.Runtime.InteropServices
GlobalAlloc Function
Volver al principio