Why Dispose When there is GC
Reply
![]() |
|
From:
![]() venkateswara-rao
|
Hi vikram..
I hv some more question to be answered...
Every .NET object has got Dispose method....So when we call
.NETobject.Dispose() ...Will it immdtly release the object from memory
What we do here is, in the finally block we enter (For example)
dataSetobj = Nothing dataSetobj.Dispose()
Nothing marks the object for gabage collection and Dispose what will do??
On Mon, 6 Dec 2004 18:29:22 -0800, valkenturbo <[EMAIL PROTECTED]> wrote: > > New Message on dotNET User Group Hyd > > > Why Dispose When there is GC > > > Reply > > Reply to Sender Recommend Message 2 in Discussion > > From: valkenturbo > > > > > Hi, > > For increased performance, it is best to cleanup your unused resources > immediately after using them. For instance, as soon as you have retrieved > your data through a database connection, the connection should be discarded > of since it eats up system resources like memory, which could be better > utilized by objects that you do in fact need. For this reason, an object can > implement the Dispose method (by implementing the IDisposable interface). > Calling the Dispose method on an object does two things. Firstly, it cleans > up any resources that were in use by your object. Secondly, it marks the > object so that the GC would not call its Finalize method when it collects it > the resources have been cleaned up already in your Dispose method. This > way, you save the overhead of the GC call to Finalize, and you can clean up > your object at the most appropriate time. > > > > Regards, > > Vikramaditya. > > > > > ________________________________ > All the news that matters. Just the way you like it. Only at MSN News! > View other groups in this category. > > > > Also on MSN: > Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily > Horoscopes > > > > To stop getting this e-mail, or change how often it arrives, go to your > E-mail Settings. > > Need help? If you've forgotten your password, please go to Passport Member > Services. > For other questions or feedback, go to our Contact Us page. > > If you do not want to receive future e-mail from this MSN group, or if you > received this message by mistake, please click the "Remove" link below. On > the pre-addressed e-mail message that opens, simply click "Send". Your > e-mail address will be deleted from this group's mailing list. > Remove my e-mail address from dotNET User Group Hyd.
-- Thanx & Regards, Venkateswara Rao M
|
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|