By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

What's memory leak?

P: n/a
I think I know what it is-- objects not being set to nothing
when the program is finished with them

How can I tell if I have it?

How can I code to avoid it?

Thanks

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Tony Van wrote:
I think I know what it is-- objects not being set to nothing
when the program is finished with them
That's one. If you have circular references (two objects pointing to
each other, but your program doesn't point to either of them anymore),
the objects are not automatically cleared. This can result in a
"hanging" application, because VB is apparently waiting for either of
them to be set to nothing.

If you are working with API calls, a memory leak can also be a memory
structure generated by the API call that is not properly "handed back"
to the operating system.

How can I tell if I have it?
Especially the last one: you probably can't.
How can I code to avoid it?


Avoid circular references, or implement some sort of Dispose method. Be
aware that if a form has an object variable that contains an object
pointing to controls on that form, VB regards it as a circular reference.
You can also use close/unload/terminate events to trigger disposal code.

Best regards
Jul 17 '05 #2

P: n/a
Thanks for a clear explanation Dik.

Need to look thru my code more carefully.

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.