Solved

Garbage collection in .NET

Posted on 2009-05-05
4
220 Views
Last Modified: 2013-11-07
I have a question how garbage collection works in .NET.  I have a website, which calls a class and then that class calls another class.  Website1 --> class1 --> class2.  If class2 throws an exception which is caught by Website1 and in the Finaly statement I set class1 = Nothing, would this clean up any and all objects tha were initialized up to the exception?  I would like your answer and maybe a link to some good article about this topic.
0
Comment
Question by:MDKDevelopers
  • 2
4 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 24303443
0
 
LVL 6

Accepted Solution

by:
openshac earned 500 total points
ID: 24303456
If class2 has any unmanaged resources, then they will not be disposed of unless you specifically call the Dispose method, otherwise it should be OK

There are heaps of GC articles online (depends on how much depth you want to go into), here's a fairly detailed one that should help:

http://www.csharphelp.com/archives2/archive297.html
0
 
LVL 33

Expert Comment

by:jppinto
ID: 24307522
The link to the article provided by the user that you've accepted the answer is the same as mine, and I posted first!

jppinto
0
 

Author Comment

by:MDKDevelopers
ID: 24307628
jppinto,
Please read my entire question,  I believe there is a statement "I would like your answer and maybe a link to some good article about this topic." I was looking for an Expert's opinion and not just a blind link to articles.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now