Is it still useful in VB.NET to assign objects to Nothing when finished using them, as mentioned here? Or has garbage collection improved to the point that this is no longer helpful/necessary?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As the others said, it’s not necessary in most cases.
If you are done using an object and want to claim its memory as soon as possible (for example, because it’s a very big entity which contains many others), make it implement the Disposable pattern and use it via the Using directive.
In the particular case in which your big object does not reference any unmanaged resource, this is not fixing a memory leak, it’s keeping your memory footprint small