When using -Xmx flag, what happens if the argument

2019-09-18 05:32发布

问题:

When using -Xmx flag, what happens if the argument given exceed physical memory?

Also is there any way to explicitly make JVM to use a specific amount of memory using paging?

回答1:

See for yourself:

JVM fails in getting enough memory for the heap and exits.

I don't think there is a way to make JVM use a specific amount of memory for paging, but you can use:

-XX:+|-UseLargePages --for large page support

and -XXLargePageSizeInBytes=<n> --for specifying how large your large pages can be.

Look at http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html