Solved

Garbage collection in .NET

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

867 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

21 Experts available now in Live!

Get 1:1 Help Now