Hi,
Iam working on an application where objects are more often have to be dynamically created!!!
How can i dispose the following objects completely from memory?
a form object
class object
dataset object
strings etc
By assigning null only its reference is lost and not the object?
Can anyone tell me the correct way of disposing these objects?
Also is it proper to use Dispose method for all objects?
Hoping for a better answer!!!
Thanks
Loading
Darren MarshallPosted May 30, 2006, 1:09 AM
As previously mentioned the Garbage Collection of the CLR does a good job for you.
Edit: By assigning null, the Object is no longer referenced and then the Garbage Collection eats up the Object and will free the memory. Cant hurt to assign null to Objects you no longer require.
Mahesh ChandPosted May 29, 2006, 10:12 AM
Using Dispose is not recommended unless you have some resources such as GDI+ that must be disposed.