none
what is difference between gc.collect and GC.WaitForPendingFinalizers RRS feed

  • Question

  • Please tell me with a example that what is difference between gc.collect and gc.WaitForPendingFinalizers

    What collect does?  Does it free memory instantly after call or just marked?

    What WaitForPendingFinalizers does?

    When call collect and when to call WaitForPendingFinalizers ?

    please explain with a easy example. Thanks

    Friday, August 23, 2019 8:06 PM

Answers

  • Hello,

    The first thing you need to do is read Collect and WaitForPendingFinalizers documentation as they spell out things clearly. And note the code sample in the docs for WaitForPendingFinalizers.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Sudip_inn Saturday, August 24, 2019 4:34 AM
    Friday, August 23, 2019 8:17 PM
    Moderator

All replies

  • Hello,

    The first thing you need to do is read Collect and WaitForPendingFinalizers documentation as they spell out things clearly. And note the code sample in the docs for WaitForPendingFinalizers.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Sudip_inn Saturday, August 24, 2019 4:34 AM
    Friday, August 23, 2019 8:17 PM
    Moderator
  • the MSDN articles for both methods contain descriptions and examples.
    What do you not understand?

    Friday, August 23, 2019 8:27 PM