title: When a JVM crashes (segfaults) during garbage collection, how can I find out what was being collected?
body: <p>I get segfaults in my JVM at <em>roughly</em> the same phase of the application, but with varying stack traces in the crash report. It always seems to happen during GC, however.</p>
  
  <p>Since the crash happens in all three JVMs I tried (OpenJDK 6, Oracle 1.6.0_25 and 1.7.0) and with two GCs each (Parallel Collector and CMS), and it happens around the same area in the application, I figured, if I could find what the GC was trying to collect, I might spot some peculiarity in my code that causes this crash.</p>
  
  <ul>
  <li>Are there any coding practices that are well known to be problematic for GC?</li>
  <li>What methods are available for diagnosing this problem?</li>
  <li>Can I make any educated guesses on where in my application this problem is triggered?</li>
  <li>What (GC tuning) parameters can I play with to narrow the problem down?</li>
  <li>Is there a way to spot (possibly) problematic data in a heap dump?</li>
  </ul>