Marshal.ReAllocHGlobal-Methode: (IntPtr, IntPtr)

 

Ändert die Größe eines bereits mit AllocHGlobal belegten Speicherblocks.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

Syntax

[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

Parameter

  • cb
    Type: System.IntPtr

    Die neue Größe des belegten Blocks. Dies ist kein Zeiger; es ist die Byteanzahl, die Sie anfordern, umgewandelt zum Typ IntPtr. Wenn Sie einen Zeiger übergeben, wird er als Größe behandelt.

Rückgabewert

Type: System.IntPtr

Ein Zeiger auf den neu reservierten Arbeitsspeicher. Dieser Speicher muss mit Marshal.FreeHGlobal freigegeben werden.

Ausnahmen

Exception Condition
OutOfMemoryException

Es ist nicht genügend Arbeitsspeicher zum Erfüllen der Anforderung vorhanden.

Hinweise

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.

Sicherheit

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Versionsinformationen

Universelle Windows-Plattform
Verfügbar seit 8
.NET Framework
Verfügbar seit 1.1
Portierbare Klassenbibliothek
Unterstützt in: portierbare .NET-Plattformen
Windows Phone
Verfügbar seit 8.1

Siehe auch

ReAllocCoTaskMem
FreeHGlobal
Marshal-Klasse
System.Runtime.InteropServices-Namespace
GlobalAlloc Function

Zurück zum Anfang