Let's write a HelloEpsilon class and execute it using Epsilon GC. Here's the sample code:
class HelloEpsilonGC { public static void main(String[] args) { System.out.println("Hello to Epsilon GC!"); } }
To execute the preceding code using Epsilon GC, you must use the -XX:+UnlockExperimentalVMOptions option with the -XX:+UseEpsilonGC option, followed by the class to execute:
>java -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC
HelloEpsilonGC
The following screenshot highlights the preceding command at the top; the remaining part includes the GC output:
As highlighted in the preceding screenshot, the following describes the GC output:
- JVM uses the Epsilon GC
- It outputs the Hello to Epsilon GC! string to the standard output
- It includes just one allocation of 792 KB
The literal...