title: How bad is it to not dispose() in Powershell?
body: <p>Sometimes we need to perform small administrative tasks in SharePoint. A simple PowerShell script is a really good tool for that. For instance, such script can enumerate event handlers of a list:</p>
  
  <pre><code>[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
  $site = new-object Microsoft.SharePoint.SPSite($args[0])   
  $site.RootWeb.Lists["MyList"].EventReceivers &gt; C:\MyListHandlers.txt
  </code></pre>
  
  <p>It's known that objects like <code>SPSite</code> and <code>SPWeb</code> have to be <code>Dispose()</code>-d after a call, otherwise memory leaks occur. The best would be to call</p>
  
  <pre><code>$site.RootWeb.dispose()
  $site.dispose()
  </code></pre>
  
  <p>at the end of this script. But if this is a Powershell script which will only be run once, and we know that PowerShell cleans up after execution - is it so bad to not call dispose()?</p>
  
  <p>So, my question is - is there some danger if sometimes I run scripts like this; will it affect the overall stability of SharePoint farm (or of the server on which I'm running the script)?</p>