Q1.Your production application crashes with java.lang.OutOfMemoryError: Java heap space. How do you troubleshoot this?
- ▸Start the JVM with -XX:+HeapDumpOnOutOfMemoryError to automatically generate a heap dump on crash.
- ▸Load the .hprof file into Eclipse MAT (Memory Analyzer Tool) or VisualVM.
- ▸Use the "Leak Suspects" report to identify which objects are retaining the most memory and trace them back to GC roots.