GCSettings.IsServerGC プロパティ

定義

サーバー ガベージ コレクションが有効かどうかを示す値を取得します。

public:
 static property bool IsServerGC { bool get(); };
public static bool IsServerGC { get; }
static member IsServerGC : bool
Public Shared ReadOnly Property IsServerGC As Boolean

プロパティ値

true サーバー ガベージ コレクションが有効な場合。それ以外の場合は false

次の例は、ホスト コンピューターがサーバーガベージ コレクションとワークステーション ガベージ コレクションのどちらを使用しているかを示しています。

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.

注釈

サーバー ガベージ コレクションの詳細については、「 ワークステーションとサーバーのガベージ コレクション」を参照してください。

サーバー ガベージ コレクションが有効になっていない場合、ワークステーション のガベージ コレクションは有効になります (同時実行コレクションの有無にかかわらず)。 サーバー ガベージ コレクションは、マルチプロセッサ コンピューターでのみ使用できます。

アンマネージド ホストはサーバー ガベージ コレクションを要求でき、ホスト要求は構成ファイルの設定をオーバーライドします。 ホストでガベージ コレクションの種類が指定されていない場合は、構成設定を使用してサーバー ガベージ コレクションを指定できます。 詳細については、「 ワークステーションとサーバーの構成」を参照してください。

適用対象