Export (0) Print
Expand All

GC.WaitForFullGCComplete Method (Int32)

Returns, in a specified time-out period, the status of a registered notification for determining whether a full, blocking garbage collection by common language the runtime has completed.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static GCNotificationStatus WaitForFullGCComplete(
	int millisecondsTimeout
)

Parameters

millisecondsTimeout
Type: System.Int32

The length of time to wait before a notification status can be obtained. Specify -1 to wait indefinitely.

Return Value

Type: System.GCNotificationStatus
The status of the registered garbage collection notification.

ExceptionCondition
InvalidOperationException

millisecondsTimeout must be either non-negative or less than or equal to MaxValue or -1.

Use the GCNotificationStatus enumeration returned by this method to determine the status of the current garbage collection notification that was registered by using the RegisterForFullGCNotification method. You can also use the WaitForFullGCApproach method to determine whether a full garbage collection is imminent.

Note that this method returns immediately whenever a garbage collection notification status is obtained, regardless of the value specified by millisecondsTimeout. If a garbage collection notification status is not obtained before millisecondsTimeout times out, this method returns NotApplicable.

When the enumeration returns Succeeded, you can do tasks such as resuming work and obtaining a collection count with the CollectionCount property.

You can call the CancelFullGCNotification method when you cannot wait for the time-out period to elapse.

This method call should be preceded with a call to the WaitForFullGCApproach method to make sure that you have had a full garbage collection. Calling this method alone can produce indeterminate results.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5 SP1, 3.0 SP2, 2.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • LinkDemand 

    for full trust for the immediate caller. This member cannot be used by partially trusted code.

  • SecurityCriticalAttribute 

    requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft