Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

If I finished using FileStream (an object?) or similar object, I close it.....but, do I need to set it to Nothing? Or, it can by set to Nothing automatically when it is out of scope?

  • *Gurus*
Posted
Garbage Collection is indeterminate, you can't tell when it's going to happen. Whenever it thinks it needs to do a cleanup. You can force it by calling GC.Collect(), but this is really only beneficial if you know you've just finished using a whole lot of objects.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

I see.....Thank you.

However, for a single object that declared/created in a procedure, can VB.Net get back the memory when the progrem runs out of the procedure?

Posted

1. Well, I have been taught many times that we should set an object to nothing if we finished use it. Poeple said that is a good habit. I have seen a lot VB6 tutorial examples doing that. Does VB6 get GC feature?

2. When VB.Net feels like to do the GC? Until the memory near hone out?

 

Regards.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...