Dispose()

  • Thread starter Thread starter Merlin
  • Start date Start date
M

Merlin

Hi,

Can anyone please advise me on how to overcome memory issues/slow up's with
VB.NET.

My Application in the design environment starts of fine but as the day
progresses it all starts grinding to a halt, it's as if the GC doesn't
bother to do it job and then later has so much collection to do it stops me
working, as were both fighting for CPU time.

I've noted a few acticles on Dispose(), will this solve my issues, and if so
where do I run it in VB.Net (at form closed event)? Any other Good Practice
suggestions?

Thanks
 
If your object holds unmanage resources, it will be a good idea to
implement a Dispose function, and call it when you no longer need that
object. Many system classes implement it, and you should call them when
you no longer need an object, so those resources could be collected before
a garbage collector does a collection.

However, garbage collector won't work more often even if you call Dispose,
since it won't help to free managed memory. If you believe GC should work
more often to improve the performance of your application. You possibly can
try to force GC to collect memory sometime,

Check:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconimplementingdisposemethod.asp
 
Back
Top