GC.WaitForFullGCComplete 메서드

정의

공용 언어 런타임에 의한 전체 차단 가비지 수집이 완료되었는지 여부를 확인하기 위한 등록된 알림의 상태를 반환합니다.

오버로드

WaitForFullGCComplete()

공용 언어 런타임에 의한 전체 차단 가비지 수집이 완료되었는지 여부를 확인하기 위한 등록된 알림의 상태를 반환합니다.

WaitForFullGCComplete(Int32)

공용 언어 런타임에 의한 전체 차단 가비지 컬렉션이 완료되었는지 여부를 확인하기 위한 등록된 알림의 상태를 지정된 제한 시간 내에 반환합니다.

WaitForFullGCComplete(TimeSpan)

차단 가비지 수집이 완료되었는지 여부에 대한 등록된 알림의 상태 반환합니다. 전체 컬렉션에 대해 무기한 대기할 수 있습니다.

WaitForFullGCComplete()

Source:
GC.CoreCLR.cs
Source:
GC.CoreCLR.cs
Source:
GC.CoreCLR.cs

공용 언어 런타임에 의한 전체 차단 가비지 수집이 완료되었는지 여부를 확인하기 위한 등록된 알림의 상태를 반환합니다.

public:
 static GCNotificationStatus WaitForFullGCComplete();
public static GCNotificationStatus WaitForFullGCComplete ();
[System.Security.SecurityCritical]
public static GCNotificationStatus WaitForFullGCComplete ();
static member WaitForFullGCComplete : unit -> GCNotificationStatus
[<System.Security.SecurityCritical>]
static member WaitForFullGCComplete : unit -> GCNotificationStatus
Public Shared Function WaitForFullGCComplete () As GCNotificationStatus

반환

등록된 가비지 수집 알림의 상태입니다.

특성

예제

다음 예제에서는 이 메서드를 사용하여 전체 가비지 수집이 완료되었는지 여부를 확인하는 방법을 보여줍니다. 알림의 상태 때마다 Succeeded완료된 컬렉션에 대한 응답으로 작업을 수행하기 위해 사용자 메서드 OnFullGCCompletedNotify 가 호출됩니다. 이 코드 예제는 가비지 수집 알림 항목에 제공된 더 큰 예제의 일부입니다.

// Check for a notification of a completed collection.
s = GC::WaitForFullGCComplete();
if (s == GCNotificationStatus::Succeeded)
{
    Console::WriteLine("GC Notification raised.");
    OnFullGCCompleteEndNotify();
}
else if (s == GCNotificationStatus::Canceled)
{
    Console::WriteLine("GC Notification cancelled.");
    break;
}
else
{
    // Could be a time out.
    Console::WriteLine("GC Notification not applicable.");
    break;
}
// Check for a notification of a completed collection.
GCNotificationStatus status = GC.WaitForFullGCComplete();
if (status == GCNotificationStatus.Succeeded)
{
    Console.WriteLine("GC Notification raised.");
    OnFullGCCompleteEndNotify();
}
else if (status == GCNotificationStatus.Canceled)
{
    Console.WriteLine("GC Notification cancelled.");
    break;
}
else
{
    // Could be a time out.
    Console.WriteLine("GC Notification not applicable.");
    break;
}
// Check for a notification of a completed collection.
match GC.WaitForFullGCComplete() with
| GCNotificationStatus.Succeeded ->
    printfn "GC Notification raised."
    onFullGCCompleteEndNotify ()
| GCNotificationStatus.Canceled ->
    printfn "GC Notification cancelled."
    broken <- true
| _ ->
    // Could be a time out.
    printfn "GC Notification not applicable."
    broken <- true
' Check for a notification of a completed collection.
s = GC.WaitForFullGCComplete
If (s = GCNotificationStatus.Succeeded) Then
    Console.WriteLine("GC Notifiction raised.")
    OnFullGCCompleteEndNotify()
ElseIf (s = GCNotificationStatus.Canceled) Then
    Console.WriteLine("GC Notification cancelled.")
    Exit While
Else
    ' Could be a time out.
    Console.WriteLine("GC Notification not applicable.")
    Exit While
End If

설명

이 메서드에서 반환된 GCNotificationStatus 열거형을 사용하여 메서드를 사용하여 RegisterForFullGCNotification 등록된 현재 가비지 수집 알림의 상태 확인합니다. 메서드를 WaitForFullGCApproach 사용하여 전체 가비지 수집이 임박했는지 여부를 확인할 수도 있습니다.

열거형이 를 반환 Succeeded하면 작업을 다시 시작하고 속성을 사용하여 컬렉션 수를 CollectionCount 가져오는 등의 작업을 수행할 수 있습니다.

이 메서드는 가비지 수집 알림을 가져올 때까지 무기한 대기합니다. 알림을 가져올 수 없는 경우 메서드가 반환할 시간 제한 기간을 지정하려면 메서드 오버로드를 GC.WaitForFullGCApproach(Int32) 사용합니다. 시간 초과를 지정하지 않고 이 메서드를 호출하는 경우 기본 설정보다 오래 기다리는 경우 메서드를 호출 CancelFullGCNotification 할 수 있습니다.

이 메서드 호출 앞에 메서드를 호출하여 WaitForFullGCApproach 전체 가비지 수집이 있는지 확인해야 합니다. 이 메서드만 호출하면 확정되지 않은 결과가 생성됩니다.

추가 정보

적용 대상

WaitForFullGCComplete(Int32)

Source:
GC.CoreCLR.cs
Source:
GC.CoreCLR.cs
Source:
GC.CoreCLR.cs

공용 언어 런타임에 의한 전체 차단 가비지 컬렉션이 완료되었는지 여부를 확인하기 위한 등록된 알림의 상태를 지정된 제한 시간 내에 반환합니다.

public:
 static GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout);
public static GCNotificationStatus WaitForFullGCComplete (int millisecondsTimeout);
[System.Security.SecurityCritical]
public static GCNotificationStatus WaitForFullGCComplete (int millisecondsTimeout);
static member WaitForFullGCComplete : int -> GCNotificationStatus
[<System.Security.SecurityCritical>]
static member WaitForFullGCComplete : int -> GCNotificationStatus
Public Shared Function WaitForFullGCComplete (millisecondsTimeout As Integer) As GCNotificationStatus

매개 변수

millisecondsTimeout
Int32

알림 상태를 가져올 때까지 기다릴 시간의 길이입니다. 무한정 기다리려면 -1을 지정합니다.

반환

등록된 가비지 수집 알림의 상태입니다.

특성

예외

millisecondsTimeout 는 음수가 아니거나 Int32.MaxValue 또는 -1보다 작거나 같아야 합니다.

설명

이 메서드에서 반환된 GCNotificationStatus 열거형을 사용하여 메서드를 사용하여 RegisterForFullGCNotification 등록된 현재 가비지 수집 알림의 상태 확인합니다. 메서드를 WaitForFullGCApproach 사용하여 전체 가비지 수집이 임박했는지 여부를 확인할 수도 있습니다.

이 메서드는 에 지정된 값에 관계없이 가비지 수집 알림 상태 가져올 때마다 즉시 반환됩니다millisecondsTimeout. 시간 초과 전에 millisecondsTimeout 가비지 수집 알림 상태 가져오지 않으면 이 메서드는 를 반환합니다NotApplicable.

열거형이 를 반환 Succeeded하면 작업을 다시 시작하고 속성을 사용하여 컬렉션 수를 CollectionCount 가져오는 등의 작업을 수행할 수 있습니다.

시간 제한 기간이 경과될 때까지 기다릴 수 없는 경우 메서드를 호출 CancelFullGCNotification 할 수 있습니다.

이 메서드 호출 앞에 메서드를 호출하여 WaitForFullGCApproach 전체 가비지 수집이 있는지 확인해야 합니다. 이 메서드만 호출하면 확정되지 않은 결과가 생성됩니다.

추가 정보

적용 대상

WaitForFullGCComplete(TimeSpan)

Source:
GC.cs
Source:
GC.cs
Source:
GC.cs

차단 가비지 수집이 완료되었는지 여부에 대한 등록된 알림의 상태 반환합니다. 전체 컬렉션에 대해 무기한 대기할 수 있습니다.

public:
 static GCNotificationStatus WaitForFullGCComplete(TimeSpan timeout);
public static GCNotificationStatus WaitForFullGCComplete (TimeSpan timeout);
static member WaitForFullGCComplete : TimeSpan -> GCNotificationStatus
Public Shared Function WaitForFullGCComplete (timeout As TimeSpan) As GCNotificationStatus

매개 변수

timeout
TimeSpan

전체 컬렉션을 기다리는 시간 제한

반환

등록된 전체 GC 알림의 상태

적용 대상