During investigation of JDK-8240654 it was found that some of the Windows GDI functions don't work with large pages (-XX:+UseLargePages). This causes severe repaint issues.
The problem can easily be seen with the Java2D demos, where the drawn UI is grayed out instead of containing all relevant components.
This can be reproduced by running building J2DBench and running:
java -Xmx1g -Xms1g -XX:+UseLargePages -Dsun.java2d.opengl=False -Dsun.java2d.d3d=False -jar dist/J2DBench.jar
The -Dsun.java2d.d3d property is used to ensure that that java2d doesn't enable the alternative, D3D implementation instead of GDI. -Dsun.java2d.opengl is turned off for the same reason.
NOTE about large pages on windows:
- It is important to give the user "Lock pages in memory" "User Rights" and login / logout.
- Verify with -Xlog:pagesize that the heap is allocated with large pages. For example:
[0.014s][info][pagesize] Heap: min=1G max=1G base=0x00000007c0000000 page_size=2M size=1G