title: Unregistered event handlers cause memory leak
body: <p>I'm maintaining a web application that has a memory leak.</p>
  
  <p>Based on my investigation using Red Gate ANTS memory profiler I'm pretty sure that the memory leak is caused by event handlers in the business layer.</p>
  
  <p>There's a collection that registers an event handler on each item that's added so that the collection can re-sort when the item's date is changed. It appears that this event handler is the culprit.</p>
  
  <p>The business layer for this application is quite complicated, so keeping the collection and its items in memory drags a bunch of other objects with it.</p>
  
  <p>I've implemented IDisposable on the collection and removed the event handlers in the Dispose method:</p>
  
  <pre><code>p.OnPunchDateChanged -= this.OnPunchDateChanged;
  </code></pre>
  
  <p>However, implementing IDisposable doesn't help since I can't wrap all the references to the collection in using or try/catch blocks. This collection is used by portions of the application that I don't have control over.</p>
  
  <p>How can I clear these event handlers to resolve this memory leak?</p>