A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.destroystructure below:

Marshal.DestroyStructure Method (System.Runtime.InteropServices) | Microsoft Learn

Source:
Marshal.CoreCLR.cs
Source:
Marshal.cs
Source:
Marshal.cs
Source:
Marshal.CoreCLR.cs

Frees all substructures that the specified unmanaged memory block points to.

public:
 static void DestroyStructure(IntPtr ptr, Type ^ structuretype);
[System.Obsolete("DestroyStructure(IntPtr, Type) may be unavailable in future releases. Instead, use DestroyStructure<T>(IntPtr). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296520")]
[System.Security.SecurityCritical]
public static void DestroyStructure(IntPtr ptr, Type structuretype);
public static void DestroyStructure(IntPtr ptr, Type structuretype);
[System.Security.SecurityCritical]
public static void DestroyStructure(IntPtr ptr, Type structuretype);
[System.Runtime.InteropServices.ComVisible(true)]
public static void DestroyStructure(IntPtr ptr, Type structuretype);
[System.Security.SecurityCritical]
[System.Runtime.InteropServices.ComVisible(true)]
public static void DestroyStructure(IntPtr ptr, Type structuretype);
[<System.Obsolete("DestroyStructure(IntPtr, Type) may be unavailable in future releases. Instead, use DestroyStructure<T>(IntPtr). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296520")>]
[<System.Security.SecurityCritical>]
static member DestroyStructure : nativeint * Type -> unit
static member DestroyStructure : nativeint * Type -> unit
[<System.Security.SecurityCritical>]
static member DestroyStructure : nativeint * Type -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
static member DestroyStructure : nativeint * Type -> unit
[<System.Security.SecurityCritical>]
[<System.Runtime.InteropServices.ComVisible(true)>]
static member DestroyStructure : nativeint * Type -> unit
Public Shared Sub DestroyStructure (ptr As IntPtr, structuretype As Type)
Parameters
ptr
IntPtr

nativeint

A pointer to an unmanaged block of memory.

structuretype
Type

Type of a formatted class. This provides the layout information necessary to delete the buffer in the ptr parameter.

Attributes
Exceptions

structuretype has an automatic layout. Use sequential or explicit instead.

Remarks

You can use this method to free reference-type fields, such as strings, of an unmanaged structure. Unlike its fields, a structure can be a value type or a reference type. Value-type structures that contain value-type fields (all blittable) have no references whose memory must be freed. The Marshal.StructureToPtr method uses this method to prevent memory leaks when reusing memory occupied by a structure.

DestroyStructure calls the COM SysFreeString function, which, in turn, frees an allocated string.

In addition to DestroyStructure, the Marshal class provides two other memory-deallocation methods: FreeCoTaskMem and FreeHGlobal.

See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4