Solved

Garbage collection in .NET

Posted on 2009-05-05
4
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 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