Marshal.AllocCoTaskMem(Int32) メソッド

定義

COM タスク メモリ アロケーターから、指定したサイズのメモリ ブロックを割り当てます。

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

パラメーター

cb
Int32

割り当てるメモリ ブロックのサイズ。

戻り値

IntPtr

nativeint

割り当てられたメモリ ブロックのアドレスを表す整数。 このメモリは、FreeCoTaskMem(IntPtr) を使用して解放する必要があります。

属性

例外

メモリが不足しているため要求を満たせません。

注釈

AllocCoTaskMem は、クラス内の 2 つのメモリ割り当て API メソッドのいずれか Marshal です。 (Marshal.AllocHGlobal もう一方です。)返される最初のメモリコンテンツは未定義であり、割り当てられたメモリは要求されたバイト数を超える可能性があります。 このメソッドは、COM タスク メモリ アロケーターと呼ばれる COM CoTaskMemAlloc 関数を公開します。

適用対象

こちらもご覧ください