Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Marshal::FreeBSTR Method (IntPtr)

 

Frees a BSTR using the COM SysFreeString function.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public:
[SecurityCriticalAttribute]
static void FreeBSTR(
	IntPtr ptr
)

Parameters

ptr
Type: System::IntPtr

The address of the BSTR to be freed.

Like Marshal::FreeCoTaskMem and Marshal::FreeHGlobal, you can use this method to deallocate memory. FreeBSTR calls the COM SysFreeString function, which frees memory allocated by any of the following unmanaged methods: SysAllocString, SysAllocStringByteLen, SysAllocStringLen, SysReAllocString, SysReAllocStringLen. You can call unmanaged methods such as these with platform invoke. For details, see Consuming Unmanaged DLL Functions.

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft