Use the request option to ask the JVM to prepare the state before starting the dump agent.
Option value | Description |
---|---|
exclusive | Request exclusive access to the JVM. |
compact | Run garbage collection. This option removes all unreachable objects from the heap before the dump is generated. |
prepwalk | Prepare the heap for walking. You must also specify exclusive when using this option. |
serial | Suspend other dumps until this one has completed. |
In general, the default request options are sufficient.
-Xdump:heap:request=exclusive+compact+prepwalk