Monitoring the Java heap

The most straightforward, and often most useful, way of monitoring the Java™ heap is by seeing what garbage collection is doing.

Start verbose tracing of garbage collection by using the command-line option -verbose:gc. The option causes a report to be written to stderr each time garbage collection occurs. You can also direct this output to a log file using:
-Xverbosegclog:[DIR_PATH][FILE_NAME]
where:
[DIR_PATH]		 is the directory where the file should be written 
[FILE_NAME]		 is the name of the file to write the logging to

See Garbage Collector diagnostic data in the J9 VM reference for more information for more information about verbose GC output and monitoring.