To tell you the truth, disposing does a lot. .NET comes with a heavy reliance to GC, and honestly, unless you're game developing, the GC usually does a good enough job of keeping the memory usage down to a minimum. Dispose does reduce the footprint, but you're right, it doesn't immediately delete and deallocate the memory. Setting the object to null seems to help very slightly as well.
One thing to keep in mind is that you're running on managed code. Truthfully, the only times you have to actually take the measures to safely destroy objects the way we know to be true is when you*space space*into unmanaged code. Usually, it's done through the destructor ~ClassName, but it's bad practice to use this on straight unmanaged code (learned that one from Ambrose). If you'd like to do more research on the matter beyond what you can do with .NET's namespaces (GC.Collect - which does cause a halt in thread to complete and should not be used unless completely necessary) read up on how the il is assembled and how it is then compiled into assembly. In my honest opinion, you're better off just finalizing the objects, and letting the garbage handler do it's job.
You're right in a strong degree in terms of the flexibility of destroying your memory usage like you could in c++, and one of the benefits I'd like to point out is that a lot of applications went assbackwards because of people handling the memory incorrectly. The drawback of using a standard approach like GC, you're faced with losing the strength and ability to do it yourself.
Again, if you're eating up that much juice, you're probably either in need of trimming your objects or calling the GC directly. But if you're stressing over 60k-20megs, I don't think it's much of a problem. Again, it's all in the application.
I do feel you though. When I see my applications start eating juice, I get a little devil on my right shoulder that tells me I'm being a bad programmer. |