语言

Marshal.ReAllocCoTaskMem(IntPtr, Int32) 方法

定义

调整以前使用 AllocCoTaskMem(Int32)分配的内存块的大小。

public:
 static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb);
[System.Security.SecurityCritical]
public static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb);
public static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb);
[<System.Security.SecurityCritical>]
static member ReAllocCoTaskMem : nativeint * int -> nativeint
static member ReAllocCoTaskMem : nativeint * int -> nativeint
Public Shared Function ReAllocCoTaskMem (pv As IntPtr, cb As Integer) As IntPtr

参数

pv
IntPtr

nativeint

指向使用 AllocCoTaskMem(Int32)分配的内存的指针。

cb
Int32

已分配块的新大小。

返回

IntPtr

nativeint

一个整数,表示重新分配的内存块的地址。 此内存必须随 FreeCoTaskMem(IntPtr).

属性

例外

内存不足,无法满足请求。

注解

ReAllocCoTaskMem 是类中两种内存重新分配方法之 Marshal 一。 (ReAllocHGlobal 是另一种。重新分配的内存内容的开头与原始内容相同:但是,整个内存块可以位于不同的位置。 此方法公开 COM CoTaskMemRealloc 函数,该函数称为 COM 任务内存分配器。

适用于

另请参阅