Quote:
Originally Posted by corwin42
Am I right that this is normally not a problem (because the GC will handle this)
|
Yes, normally you should let the GC do its' job.
Quote:
|
but it's a bad idea for objects that use unmanaged memory or implement IDisposable?
|
It's only really a problem for things like (and it's the only example I can think of) Bitmaps where the ratio of unmanaged memory used by the underlying native object is very large in relation to the small amount of managed memory used to encapsulate it for .NET use. Before reusing the same object name the only things other than Bitmap and BitmapEx that I would rooutinely Dispose would be Drawer andDrawerEx that are really GDI Graphics objects.
If you don't have problems I would not worry about memory use or using Dispose.