title: How to improve garbage collection performance?
body: <p>What kind of optimization patterns can be used to improve the performance of the garbage collector? </p>
  
  <p>My reason for asking is that I do a lot of embedded software using the Compact Framework. On slow devices the garbage collection can become a problem, and I would like to reduce the times the garbage collector kicks in, and when it does, I want it to finish quicker. I can also see that working with the garbage collector instead of against it could help improve any  .NET or Java application, especially heavy duty web applications.</p>
  
  <p>Here are some of my thoughts, but I haven’t done any benchmarks.</p>
  
  <ul>
  <li>reusing temporary classes/arrays (keep down allocation count)</li>
  <li>keeping the amount of live objects to a minimum (faster collections)</li>
  <li>try to use structs instead of classes</li>
  </ul>