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

適用対象

こちらもご覧ください