Skip to content
Advertisement

Can Eclipse run with Z Garbage Collector?

I tried to change from -XX:+UseG1GC to -XX:+UseZGC in eclipse.ini

-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseZGC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms512m
-Xmx2048m
--add-modules=ALL-SYSTEM

When I tried to run terminal in eclipse to show default GC in used, I found that the eclipse still using -XX:UseG1GC mode instead. Can someone help on this issue?

Microsoft Windows [Version 10.0.19042.804]
(c) 2020 Microsoft Corporation. All rights reserved.

C:eclipseworkspacetestProgram>java -XX:+PrintCommandLineFlags -version
-XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=263203904 -XX:MarkStackSize=4194
304 -XX:MaxHeapSize=4211262464 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+Segmented
CodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation
openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9-18)
OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode)

Advertisement

Answer

The eclipse.ini settings are just used for Eclipse itself, they don’t change anything else. To see what Eclipse is using open the “Help > About” dialog (“Eclipse > About” on macOS), click the “Installation Details” button and look at the “Configuration Tab”.

For Java programs you run from within Eclipse using the ‘Run’ command the ‘Run Configuration’ sets what is used. See the ‘VM Arguments’ section of the ‘Arguments’ tab.

You can set default VM arguments for a JRE/JDK in the ‘Java > Installed JREs’ page of the Preferences.

None of the Eclipse settings changes the options for a ‘java’ command you run from a terminal.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement