Skip to content

Commit 5e4f445

Browse files
authored
GC.SuppressFinalize clarification (#3279)
1 parent 0972c6c commit 5e4f445

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xml/System/GC.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,9 @@ This method is most useful in monitoring scenarios for measuring the difference
14151415
<format type="text/markdown"><![CDATA[
14161416
14171417
## Remarks
1418-
This method sets a bit in the object header of `obj`, which the runtime checks when calling finalizers. A finalizer, which is represented by the <xref:System.Object.Finalize%2A?displayProperty=nameWithType> method, is used to release unmanaged resources before an object is garbage-collected. If `obj` does not have a finalizer, the call to the <xref:System.GC.SuppressFinalize%2A> method has no effect.
1418+
1419+
This method sets a bit in the object header of `obj`, which the runtime checks when calling finalizers. A finalizer, which is represented by the <xref:System.Object.Finalize%2A?displayProperty=nameWithType> method, is used to release unmanaged resources before an object is garbage-collected.
1420+
If `obj` does not have a finalizer or the GC has already signaled the finalizer thread to run the finalizer, the call to the <xref:System.GC.SuppressFinalize%2A> method has no effect.
14191421
14201422
Objects that implement the <xref:System.IDisposable> interface can call this method from the object's <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> implementation to prevent the garbage collector from calling <xref:System.Object.Finalize%2A?displayProperty=nameWithType> on an object that does not require it. Typically, this is done to prevent the finalizer from releasing unmanaged resources that have already been freed by the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> implementation.
14211423

0 commit comments

Comments
 (0)