GCSettings.IsServerGC Property
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.
Gets a value that indicates whether server garbage collection is enabled.
public:
static property bool IsServerGC { bool get(); };
public static bool IsServerGC { get; }
static member IsServerGC : bool
Public Shared ReadOnly Property IsServerGC As Boolean
Property Value
true
if server garbage collection is enabled; otherwise, false
.
Examples
The following example indicates whether the host computer is using server or workstation garbage collection.
using System;
using System.Runtime;
class Sample
{
public static void Main()
{
string result;
if (GCSettings.IsServerGC)
result = "server";
else
result = "workstation";
Console.WriteLine("The {0} garbage collector is running.", result);
}
}
// The example displays output like the following:
// The workstation garbage collector is running.
Imports System.Runtime
Class Sample
Public Shared Sub Main()
Dim result As String
If GCSettings.IsServerGC = True Then
result = "server"
Else
result = "workstation"
End If
Console.WriteLine("The {0} garbage collector is running.", result)
End Sub
End Class
' The example displays output like the following:
' The workstation garbage collector is running.
Remarks
For information about server garbage collection, see Workstation and Server Garbage Collection.
If server garbage collection is not enabled, workstation garbage collection is in effect (with or without concurrent collection). Server garbage collection is available only on multiprocessor computers.
An unmanaged host can request server garbage collection, and the host request overrides configuration file settings. If the host does not specify the type of garbage collection, you can use a configuration setting to specify server garbage collection. For more information, see Configure workstation vs. server.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기