Marshal.ReAllocHGlobal(IntPtr, IntPtr) 메서드
정의
AllocHGlobal(IntPtr)을 사용하여 이전에 할당된 메모리 블록 크기를 조정합니다.Resizes a block of memory previously allocated with AllocHGlobal(IntPtr).
public:
static IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb);
[System.Security.SecurityCritical]
public static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
public static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
[<System.Security.SecurityCritical>]
static member ReAllocHGlobal : nativeint * nativeint -> nativeint
static member ReAllocHGlobal : nativeint * nativeint -> nativeint
Public Shared Function ReAllocHGlobal (pv As IntPtr, cb As IntPtr) As IntPtr
매개 변수
- pv
- IntPtr
AllocHGlobal(IntPtr)을 사용하여 할당된 메모리에 대한 포인터입니다.A pointer to memory allocated with AllocHGlobal(IntPtr).
- cb
- IntPtr
할당된 블록의 새 크기입니다.The new size of the allocated block. 이것은 포인터가 아니라 요청하는 바이트 수로, 형식 IntPtr로 캐스팅합니다.This is not a pointer; it is the byte count you are requesting, cast to type IntPtr. 포인터를 전달하면 크기로 처리됩니다.If you pass a pointer, it is treated as a size.
반환
다시 할당된 메모리에 대한 포인터입니다.A pointer to the reallocated memory. 이 메모리는 FreeHGlobal(IntPtr)을 사용하여 해제되어야 합니다.This memory must be released using FreeHGlobal(IntPtr).
- 특성
예외
메모리가 부족하여 요청을 만족시킬 수 없습니다.There is insufficient memory to satisfy the request.
설명
ReAllocHGlobal 는 클래스의 두 메모리 재할당 API 메서드 중 하나입니다 Marshal .ReAllocHGlobal is one of two memory reallocation API methods in the Marshal class. ( Marshal.ReAllocCoTaskMem 은 다른입니다.)(Marshal.ReAllocCoTaskMem is the other.)
이 메서드는 Kernel32.dll에서 Win32 GlobalReAlloc 함수를 노출 합니다.This method exposes the Win32 GlobalReAlloc 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.