Guest learn Posted August 29, 2002 Posted August 29, 2002 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? Quote
*Gurus* Derek Stone Posted August 29, 2002 *Gurus* Posted August 29, 2002 The Garbage Collector (abbreviated GC) will dispose of the object for you. So, unless you're overly worried about memory usage there is Nothing to worry about. ;) Quote Posting Guidelines
Guest learn Posted August 29, 2002 Posted August 29, 2002 Can you tell me when it will by done? Quote
*Gurus* divil Posted August 30, 2002 *Gurus* Posted August 30, 2002 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest learn Posted August 30, 2002 Posted August 30, 2002 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? Quote
*Gurus* divil Posted August 30, 2002 *Gurus* Posted August 30, 2002 As I said, it will get back the memory when it feels it's appropriate. May I ask why this is an issue? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest learn Posted August 31, 2002 Posted August 31, 2002 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. Quote
*Gurus* Derek Stone Posted September 1, 2002 *Gurus* Posted September 1, 2002 Trust both divil and I when we say you don't need to worry about it. Visual Basic 6 and its memory handling differs greatly from .NET's, and the two shouldn't be compared in that aspect. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.