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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With