Edit: My question isn't getting the main answer that I was looking for. I wasn't clear. I would really like to know two things:
- Can NOT calling
Dispose()
cause memory leaks? - What's the worst thing that can happen if you have a large program and never call Dispose() on any of your IDisposable objects?
I was under the impression that memory leaks could occur if Dispose()
isn't called on IDisposable
objects.
Per the discussion on this thread, my perception was incorrect; a memory leak will NOT occur if Dispose()
isn't called.
Why ever bother calling Dispose()
then? Is it just to free the resource immediately, instead of sometime later? What's the worst thing that can happen if you have a large program and never call Dispose()
on any of your IDisposable
objects?