GCSettings.IsServerGC Vlastnost
Definice
Získá hodnotu, která označuje, zda je povoleno uvolňování paměti serveru.Gets a value that indicates whether server garbage collection is enabled.
public:
static property bool IsServerGC { bool get(); };
public static bool IsServerGC { get; }
member this.IsServerGC : bool
Public Shared ReadOnly Property IsServerGC As Boolean
Hodnota vlastnosti
true Pokud je povoleno shromažďování paměti serveru, v opačném případě false .true if server garbage collection is enabled; otherwise, false.
Příklady
Následující příklad uvádí, zda hostitelský počítač používá uvolňování paměti serveru nebo pracovní stanice.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 == true)
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.
Poznámky
Informace o uvolňování paměti serveru najdete v části "uvolňování paměti pracovních stanic a serverů" v tématu Základy uvolňování paměti.For information about server garbage collection, see the "Workstation and Server Garbage Collection" section in Fundamentals of Garbage Collection.
Pokud není povoleno uvolňování paměti serveru, je uvolňování paměti pracovní stanice v platnosti (s souběžnou kolekcí nebo bez ní).If server garbage collection is not enabled, workstation garbage collection is in effect (with or without concurrent collection). Uvolňování paměti serveru je k dispozici pouze v počítačích s více procesory.Server garbage collection is available only on multiprocessor computers.
Nespravovaný hostitel může vyžádat uvolnění paměti serveru a požadavek hostitele přepíše nastavení konfiguračního souboru.An unmanaged host can request server garbage collection, and the host request overrides configuration file settings. Pokud hostitel neurčí typ uvolňování paměti, můžete použít nastavení konfiguračního souboru a zadat tak uvolnění paměti serveru.If the host does not specify the type of garbage collection, you can use a configuration file setting to specify server garbage collection. Toto nastavení je platné pouze v konfiguračním souboru aplikace, nikoli v konfiguračním souboru počítače (viz Konfigurace aplikací).This setting is valid only in the application configuration file, not in the machine configuration file (see Configuring Apps). Následující příklad ukazuje obsah ukázkového konfiguračního souboru aplikace, který umožňuje uvolnění paměti serveru.The following example shows the contents of a sample application configuration file that enables server garbage collection.
<configuration>
<runtime>
<gcServer enabled="true" />
</runtime>
</configuration>