title: Prevent memory leaks in WPF
body: <p>Working with <code>WinForms</code> you have to free memory after using gdi objects, event handlers, objects from native code, etc.</p>
  
  <p>In <code>WinForms</code> I used to remove for example event handlers in the dispose method.</p>
  
  <p>What is the best workaround to prevent memory leaks in <code>Wpf</code>? Is it the same as in <code>Winforms</code> using <code>Dispose pattern</code>? At all, do I have to care about event handlers, gdi objects in <code>Wpf</code>? What about the runtime created resources(<code>Brushes</code>, etc)?</p>