title: CLR out of memory exceptions
body: <p>We are getting a lot of out of memory exceptions and we can't seem to diagnose what is happening. It seems to be an issue that happens that will spike memory usage from 300 MB to over 1 GB in a matter of a few minutes. Now this is an <a href="https://en.wikipedia.org/wiki/Internet_Information_Services" rel="nofollow noreferrer">IIS</a> application and has three <a href="https://en.wikipedia.org/wiki/Application_domain" rel="nofollow noreferrer">application domains</a> running in separate thread pools.</p>
  <p>We want to record when the <em>memory</em> exceptions are about to happen. So we can attempt to find a pattern. What is the best way to do this?</p>
  <p>Is there a way to <em>query</em> the <em>memory</em> usage once a minute to see how high it is and send an alert email. Or maybe write an application that will monitor the CLR's memory usage? An ideas or a direction are more than welcome.</p>
  <p>I am using <a href="https://en.wikipedia.org/wiki/Performance_Monitor" rel="nofollow noreferrer">Performance Monitor</a>, but unless I am watching the process it is not that useful. I can only see what is was and when. I have also used the Red Gate Memory Profile tool, which is awesome by the way - only I cannot seem to hit upon the page or process that is causing the exception.</p>