|
-
Oct 24th, 2007, 02:54 AM
#1
Thread Starter
Hyperactive Member
Performance Issue
My application is taking too much memory while its running even some forms are closed but still forms are not releasing its utilized memory. all this leads to performance issue.
what method should i adopt so that my form after closing release all its allocated memory. my forms are also using some third party controls like True DBGrid...
plz help me out...
-
Oct 24th, 2007, 03:07 AM
#2
Re: Performance Issue
Forms don't need to, and aren't supposed to, release all their memory when they're closed. The .NET Framework provides automatic memory management with a garbage collector that will reclaim memory in a fashion optimal to system usage patterns. You should go to MSDN and read about .NET resource and memory management, but there are two very simple rules that will cover you in 99.99% of situations:
1. If you no longer need an object and it has a Dispose method or equivalent, call that method.
2. If you no longer need a reference to an object and the variable will not, or may not, lose scope for some time then set the variable to Nothing.
That's really all you need.
-
Oct 26th, 2007, 10:52 AM
#3
Fanatic Member
Re: Performance Issue
If you are really worried about it, you can always force the Garbage Collection to happen after a form closes:
GC.Collect();
If your problem is solved, please use the Mark Thread As Resolved under Thread Tools!
Show Appreciation. Rate Posts!
-
Oct 26th, 2007, 08:47 PM
#4
Re: Performance Issue
 Originally Posted by MetalKid
If you are really worried about it, you can always force the Garbage Collection to happen after a form closes:
GC.Collect();
You can but you shouldn't. You shouldn't force garbage collection without a good reason. If you don't know that you have a good reason then you probably don't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|