The following VM parameters should always be set in your production environment to log relevant information. Even if they come with a small price in terms of performance costs (mostly disk I/O), if they are not set, you have quite a challenge ahead of you to resolve any VM-related problems (memory, GC, and so on) in your applications.
To retrieve basic memory details after each collection, add the following parameter:
-verbose:gc
The logged output looks like the following for a minor and major GC, respectively:
[GC 85310K->39093K(173056K), 0.0123160 secs] [Full GC 39093K->25698K(173056K), 0.1902890 secs]
First, on each line, GC
means that a minor GC is executed, whereas Full GC
naturally means that a full or major GC has executed.
The numbers before and after the arrow (->
) tell us how much memory in the heap was allocated by objects before and after the GC, respectively.
Then comes a number in parentheses. This number is the total committed amount...