Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322602
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:12:06+00:00 2026-05-17T23:12:06+00:00

When I read a few articles about memory management in C#, I was confused

  • 0

When I read a few articles about memory management in C#, I was confused by Finalizer methods.

There are so many complicated rules which related with them.
For instance, nobody knows when the finalizers will be called, they called even if code in ctor throws, CLR doesn’t guarantee that all finalizers be called when programs shutdowt, etc.

For what finalizers can be used in real life?

The only one example which I found was program which beeps when GC starts.

Do you use Finalizers in your code and may have some good samples ?

UPD:

Finalizers can be used when developpers want to make sure that some class always disposed correctly through IDisposable. (link ; Thanks Steve Townsend)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:12:06+00:00Added an answer on May 17, 2026 at 11:12 pm

    There is an exhaustive discussion of Finalizer usage, with examples, here. Link courtesy of @SLaks at a related answer.

    See also here for a more concise summary of when you need one (which is "not very often").

    There’s a nice prior answer here with another good real-world example.

    To summarize with a pertinent extract:

    Finalizers are needed to guarantee the
    release of scarce resources back into
    the operating system like file handles, sockets,
    kernel objects, etc.

    For more correct real-world examples, browse around affected classes in .Net:

    https://learn.microsoft.com/en-us/search/?terms=.Finalize&scope=.NET

    One valid reason I can think of when you might need to use a finalizer is if you wrap a third-party native code API in a managed wrapper, and the underlying native code API library requires the timely release of used operating system resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read few articles about table partioning but still I am bit confused
I've read a few articles about cryptography in .net, which leads me to the
I've read a few articles about MVC but there's one thing that isn't clear
I've read a few articles talking about checkboxes always returning a false state, but
Possible Duplicate: Garbage Collection in C++ — why? Hi, I read few articles about
I have read a few articles on Internet about programming language choice in the
I've read a few of the articles about the need / applicability / practicality
I've read up a good few articles etc., here and from Google, about trying
I read a few other articles about how people want to customize the colors
I have read few good articles about NHibernate localization but nothing seems to fit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.