Returns, in a specified time-out period, the status of a registered notification for determining whether a full, blocking garbage collection by the common language runtime is imminent.
![]()
The status of the registered garbage collection notification.
Use the GCNotificationStatus enumeration returned by this method to determine the status of the current garbage collection notification that was registered by using the GC.RegisterForFullGCNotification(int, int) method. You can also use the GC.WaitForFullGCComplete method to determine whether the full garbage collection has completed.
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 GCNotificationStatus.NotApplicable.
When the enumeration returns GCNotificationStatus.Succeeded, you can do tasks such as preventing additional objects from being allocated and inducing a collection yourself with the GC.Collect method. Note that the notification does not guarantee that a full garbage collection will occur, only that conditions have reached the threshold that are favorable for a full garbage collection to occur.
You can call the GC.CancelFullGCNotification method when you cannot wait for the time-out period to elapse.
You should follow this method with a call to the erload:System.GC.WaitForFullGCComplete method to make sure that you have had a full garbage collection. Calling this method alone causes indeterminate results.