In Web applications, memory utilization can impact system performance significantly. One of the most common memory problems is memory leak, which causes severe performance degradation. In theory, memory leaks should not happen in Java™ because it has Garbage Collection (GC). However, GC only cleans up unused objects that are not referenced anymore. Therefore, if an object is not used, but is still referenced, GC does not remove it, which leads to memory leaks. Beside memory leaks, other memory problems that you might encounter are memory fragmentation, large objects, and tuning problems. In many cases, these memory problems can cause the application server to crash. Many users first notice that application server performance gradually declines, and eventually crashes with OutOfMemory exceptions.
Enabling verbose Garbage Collection for WebSphere based Application servers, is simple (see image). After a restart garbage collection is logged in native_stderr.log:
There are many tools for verbose GC log analysis, these tools can abstract useful information, and illustrate the trend of JVM heap size usage over time as the following.
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector (PMAT) parses the IBM verbose GC trace and provides a comprehensive analysis of the Java heap usage. It then recommends key configurations by first executing a diagnosis engine and then employing a pattern modeling algorithm in order to make recommendations to optimize the Java heap usage for a given JVM cycle.
see also here