共用方式為


GC (VSPerfCmd)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The GC option enables the collection of .NET Framework memory allocation and object lifetime data. The GC option can only be used with the sampling profiling method and only with the Launch option.

When you are using the GC option, the VSPerfClrEnv /sampleon command is not required.

If no parameters are specified, or if the Allocation parameter is specified, only .NET Framework memory allocation data is collected. If the Lifetime parameter is specified, both .NET Framework memory allocation and .NET Framework object lifetime data is collected.

Syntax

VSPerfCmd.exe /Launch:AppName /GC[:{Allocation|Lifetime}] [Options]

Parameters

Allocation Default. Collects .NET Framework memory allocation data.

Lifetime Collects both .NET Framework memory allocation data and .NET Framework object lifetime data.

Required Options

The GC option can only be used with the Launch option.

Launch: AppName Starts the specified application and begins profiling with the sampling method.

Example

The following example launches an application and collects .NET Framework memory allocation data.

VSPerfCmd.exe /Launch:TestApp.exe /gc

See also