is it possible to log how many objects is garbage collected?
<p>I'm writing HFT trading application. I'm trying to optimize my application to minimize number of objects that garbage collected.</p>

<p>Example of optimization: instead of calling <code>new Instrument(ticker)</code> many times I create <code>HashSet&lt;string /*ticker*/, Instrument&gt;</code></p>

<p>So it would be interesting to have such statistics: when application is finished I want to know how many objects were garbage collected during execution. So latter I can compare this number with "optimized" version to check that "optimization" is actually works.</p>

<p>If it is not possible to have such statistics then how can I test if my optimizations works i.e. actually decrease GC use?</p>
