Java VisualVM Enable heap dump in OOME

According to the documentation, you can automatically take a bunch of dumps when an application encounters an OutOfMemoryException.
After the OutOfMemoryException process simply disappears from the menu on the left.
How does this feature work in VisualVM?

Thanks.


C: \ work \ temp> java -XX: HeapDumpPath = c: /work/temp/file.hprof -XX: + HeapDumpOnOutOfMemoryError -jar example.jar

+4
source share
2 answers

As far as I know, this parameter in JVisualVM is equivalent to defining -XX:+HeapDumpOnOutOfMemoryError as a JVM parameter. This causes the JVM to create a heap dump file when it encounters an OutOfMemoryError. Then this file can be downloaded to JVisualVM (or to the profiler) and analyzed there. The directory in which the file is stored is determined by the -XX:HeapDumpPath parameter.

See also:

+16
source

It seems that the application has just come out in OOM. In this case, you must run the application with the -XX special parameters. See "Dump Settings" in the JVM Documentation . After the application dies, you can examine the dump in your tool.

+3
source

Source: https://habr.com/ru/post/1383639/


All Articles