GC.RefreshMemoryLimit Method
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.
Instructs the Garbage Collector to reconfigure itself by detecting the various memory limits on the system.
public:
static void RefreshMemoryLimit();
public static void RefreshMemoryLimit ();
static member RefreshMemoryLimit : unit -> unit
Public Shared Sub RefreshMemoryLimit ()
Exceptions
The hard limit is too low. This can happen if the heap hard limit that the refresh will set, either because of new AppData settings or implied by the container memory-limit changes, is lower than what's already committed.
-or-
The hard limit is invalid. This can happen, for example, with negative heap hard-limit percentages.
Remarks
In addition to actual physical memory limit and container-limit settings, these configuration settings can be overwritten:
- GCHeapHardLimit
- GCHeapHardLimitPercent
- GCHeapHardLimitSOH
- GCHeapHardLimitLOH
- GCHeapHardLimitPOH
- GCHeapHardLimitSOHPercent
- GCHeapHardLimitLOHPercent
- GCHeapHardLimitPOHPercent
Instead of updating the environment variable (which won't be read), these override these settings by using a ulong value in the AppContext.
For example, you can use AppContext.SetData("GCHeapHardLimit", (ulong) 100 * 1024 * 1024)
to override the GCHeapHardLimit to 100M.
This API only handles configs that can be handled when the runtime is loaded. For configs that don't have any effects on 32-bit systems (like the GCHeapHardLimit* ones), this API will not handle it.
Applies to
Povratne informacije
https://aka.ms/ContentUserFeedback.
Kmalu na voljo: V letu 2024 bomo ukinili storitev Težave v storitvi GitHub kot mehanizem za povratne informacije za vsebino in jo zamenjali z novim sistemom za povratne informacije. Za več informacij si oglejte:Pošlji in prikaži povratne informacije za