Instead of thinking in terms of some vaguely defined “resources,” think of IDisposable as meaning “This object manipulates something outside of itself (and possibly even outside of the computer!) In a way that needs to be cleaned up, whereas information, necessary for such cleaning still exists. " The finalizer, who shoots essentially, says: "Nobody uses this material anymore, and I'm the only one who knows about it, I’d better clean it because nobody is going to."
It is dangerous to assume that finalizers will worry about things; while many objects can be safely left behind, many others cannot. In some cases, it will be easy for an object to detect that it has been left and cleaned accordingly. In some other cases, it can be as difficult as being impractical. Consider an object that must count how many times the word “quack” appears in a long-term data stream. If the creator of the object has forgotten about this, and no one is going to request an invoice, the object may also leave. Unfortunately, since the data stream contains a reference to the counting object (to tell it when the data arrives), the counter object will not disappear. If the code creates a counter, then forgets about it, then creates another, forgets about it, etc. This can become an unlimited memory leak.
source share