GC Methods

GC Methods

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

The GC type exposes the following members.

  NameDescription
Public method Static member AddMemoryPressure Security Critical. Informs the runtime of a large allocation of unmanaged memory that should be taken into account when scheduling garbage collection.
Public method Static member Collect Induces an immediate garbage collection of all generations.
Public method Static member Collect(Int32) Security Critical. Induces an immediate garbage collection of a specified generation.
Public method Static member Collect(Int32, GCCollectionMode) Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value.
Public method Static member Collect(Int32, GCCollectionMode, Boolean) Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value, with a value specifying whether the collection should be blocking.
Public method Static member CollectionCount Returns the number of times garbage collection has occurred for the specified generation of objects.
Public method Static member GetGeneration Security Critical. Retrieves the generation of a specified object.
Public method Static member GetTotalMemory Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval before returning, to allow the system to collect garbage and finalize objects.
Public method Static member KeepAlive References the specified object, which makes it ineligible for garbage collection from the start of the current routine to the point where this method is called.
Public method Static member RemoveMemoryPressure Security Critical. Informs the runtime that unmanaged memory has been released and no longer needs to be taken into account when scheduling garbage collection.
Public method Static member ReRegisterForFinalize Requests that the system call the finalizer for the specified object for which SuppressFinalize has previously been called.
Public method Static member SuppressFinalize Requests that the system not call the finalizer for the specified object.
Public method Static member WaitForPendingFinalizers Suspends the current thread until the thread that is processing the queue of finalizers has emptied that queue.
Top

Show:
© 2017 Microsoft