GC.Collect Method

Forces garbage collection.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Collect() Forces an immediate garbage collection of all generations.
Public method Static member Supported by Portable Class Library Collect(Int32) Forces an immediate garbage collection from generation 0 through a specified generation.
Public method Static member Supported by Portable Class Library 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 Collect(Int32, GCCollectionMode, Boolean, Boolean) Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value, with values that specify whether the collection should be blocking and compacting.
Top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft