O'Reilly logo

Java EE 8 High Performance by Romain Manni-Bucau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Debugging GC behavior

Now that we know how to tune the memory quite finely, we need to know what our application does, to be able to adjust the configuration. To do so, the JVM provides several ad hoc tools.

The most common and, probably, the most useful tool for the memory is the -verbose:gc option that you can pass launching your JVM. It will output memory information. If we activate it on our quote application, you will quickly see these sorts of lines:

[GC (Allocation Failure) 41320K->14967K(153600K), 0.0115487 secs][GC (Metadata GC Threshold) 44213K->20306K(153600K), 0.0195955 secs][Full GC (Metadata GC Threshold) 20306K->13993K(139264K), 0.0596210 secs][GC (Allocation Failure) 77481K->23444K(171008K), 0.0081158 secs][GC (Metadata GC ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required