Solved

Garbage collection in .NET

Posted on 2009-05-05
4
224 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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