Marshal.FreeCoTaskMem(IntPtr) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Frees a block of memory allocated by the unmanaged COM task memory allocator.
public:
static void FreeCoTaskMem(IntPtr ptr);
[System.Security.SecurityCritical]
public static void FreeCoTaskMem (IntPtr ptr);
public static void FreeCoTaskMem (IntPtr ptr);
[<System.Security.SecurityCritical>]
static member FreeCoTaskMem : nativeint -> unit
static member FreeCoTaskMem : nativeint -> unit
Public Shared Sub FreeCoTaskMem (ptr As IntPtr)
Parameters
- ptr
-
IntPtr
nativeint
The address of the memory to be freed.
- Attributes
Remarks
You can use FreeCoTaskMem to free any memory allocated by AllocCoTaskMem, ReAllocCoTaskMem, or any equivalent unmanaged method. If the ptr
parameter is IntPtr.Zero
, the method does nothing.
FreeCoTaskMem exposes the COM CoTaskMemFree function, which frees all bytes so that you can no longer use the memory that the ptr
parameter points to.
In addition to FreeCoTaskMem, the Marshal class provides two other memory-deallocation methods: DestroyStructure and FreeHGlobal.
Applies to
See also
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour