我已经阅读了很多关于Oracle jre-8的文档和规范。想要让Eclipse在长时间运行时运行得更快,意味着启动时间不那么显着 - 使用更多内存。对于6GB的PC,我决定IDE的最大值为2gb,因为浏览器和Web服务器也需要一些。
安装了Eclipse PDT 4.7和许多模块。对于使用jre-8的Eclipse版本应该是相同的。从oracle安装server-jre-1.8。安装程序jre在主文件夹中对其进行upack,而系统java是另一个,并将eclipse指向该安装位置。
答案 0 :(得分:2)
这仅适用于oracle最新的Java 8和Eclipse 4.7.2。 (较旧的eclipse版本也可以使用,如果他们使用oracle jre-1.8)使用大约1GB的内存,最大(从未达到)2g。它可以通过修改运行在更少或更多的内存上,而不仅仅是xmx,xms。 GC运行频率较低,因此Eclipse运行更加顺畅。开始很长,也是第一次快速打开一些视角,但下次要快得多。
这也适用于Oracle 9,但需要进行一些修改。
eclipse.ini :(使用doucumentation,如果导致问题,你可以删除它)
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.php.product
#Turn off splash. Better for Ubuntu Unity
-nosplash
#-showsplash
#org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
#
#client or server VM
#-client
-server
-vm
/home/lenya/Java/server-jre-1.8.0_162-oracle/bin
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
#
#Enable the G1 Collector
#Configured for oracle java 8, lower response time
#Using docs: https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/
-XX:+UnlockExperimentalVMOptions
-XX:+UseLargePages
-XX:+UseCompressedOops
-XX:+UseStringDeduplication
-XX:+UseFastAccessorMethods
-XX:-DontCompileHugeMethods
-XX:-UseLoopPredicate
-XX:+UseG1GC
#
#This is interpreted as a hint to the garbage collector that pause times of <nnn> milliseconds or less are desired.
#The garbage collector will adjust the Java heap size and other parameters related to garbage collection in an
#attempt to keep garbage collection pauses shorter than <nnn> milliseconds. By default there is no maximum pause
#time goal. These adjustments may cause garbage collector to occur more frequently, reducing the overall throughput
#of the application. The garbage collector tries to meet any pause time goal before the throughput goal.
#In some cases, though, the desired pause time goal cannot be met.
#__For lower response time - more maximum pause__ __Larger heap needed__
-XX:MaxGCPauseMillis=5000
#
#The throughput goal is measured in terms of the time spent collecting garbage and the time spent outside of garbage
#collection (referred to as application time). The goal is specified by the command-line option -XX:GCTimeRatio=<nnn>.
#The ratio of garbage collection time to application time is 1 / (1 + <nnn>). For example, -XX:GCTimeRatio=19 sets
#a goal of 1/20th or 5% of the total time for garbage collection.
#
#The time spent in garbage collection is the total time for both the young generation and old generation collections combined.
#If the throughput goal is not being met, then the sizes of the generations are increased in an effort to increase the time
#that the application can run between collections.
# __Larger heap needed__
-XX:GCTimeRatio=99
#
#Sets the Java heap occupancy threshold that triggers a marking cycle.
#Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by G1 to trigger a concurrent GC
#cycle based on the occupancy of the entire heap, not just one of the generations.
#A value of 0 denotes 'do constant GC cycles'. The default value is 45
-XX:InitiatingHeapOccupancyPercent=70
#
#Sets the occupancy threshold for an old region to be included in a mixed garbage collection cycle.
-XX:+UnlockExperimentalVMOptions
-XX:G1MixedGCLiveThresholdPercent=80
#
#Sets the percentage of heap that you are willing to waste. The Java HotSpot VM does not initiate the
#mixed garbage collection cycle when the reclaimable percentage is less than the heap waste percentage
-XX:G1HeapWastePercent=10
#
#Sets the target number of mixed garbage collections after a marking cycle to collect old regions with
#at most G1MixedGCLIveThresholdPercent live data. The default is 8 mixed garbage collections.
#The goal for mixed collections is to be within this target number
#-XX:G1MixedGCCountTarget=64
#
#Sets an upper limit on the number of old regions to be collected during a mixed garbage collection cycle.
#The default is 10 percent of the Java heap
-XX:G1OldCSetRegionThresholdPercent=5
#
#G1 creates a false ceiling by trying to leave the reserve memory free in case more 'to-space' is desired
#__Ajust depending on heap size__
-XX:G1ReservePercent=15
#
#Sets the percentage of the heap to use as the minimum for the young generation size. The default value is 5 percent of your Java heap
-XX:+UnlockExperimentalVMOptions
-XX:G1NewSizePercent=5
#Sets the percentage of the heap size to use as the maximum for young generation size. The default value is 60 percent of your Java heap
-XX:+UnlockExperimentalVMOptions
-XX:G1MaxNewSizePercent=50
#
#Sets the number of parallel marking threads. Sets n to approximately 1/4 of the number of parallel garbage collection threads (ParallelGCThreads).
#Number of threads concurrent garbage collectors will use.
#The default value varies with the platform on which the JVM is running
-XX:ConcGCThreads=2
#
#Sets the value of the STW worker threads. Sets the value of n to the number of logical processors.
#Sets the number of threads used during parallel phases of the garbage collectors.
#The default value varies with the platform on which the JVM is running.
-XX:ParallelGCThreads=4
#
#With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions.
#The default value of this parameter is determined ergonomically based upon heap size.
#The minimum value is 1Mb and the maximum value is 32Mb. The goal is to have around 2048 regions based on the minimum Java heap size.
-XX:G1HeapRegionSize=1m
#
#Sets the thread stack size.
-Xss16m
#
#Specifies the initial size, in bytes, of the memory allocation pool. The default value is chosen at runtime based on system configuration.
#__Disable it for auto configuration, changed at run time__
-Xms1g
#
#Specifies the maximum size, in bytes, of the memory allocation pool.
#__Do avoid swapping__ __Set less, and tune GC__
-Xmx2g
#
#Sets the mode of the bytecode verifier. Bytecode verification ensures that class files are properly formed and
#satisfy the constraints listed in section 4.10, Verification of class Files in the The Java Virtual Machine Specification.
#Do not turn off verification as this reduces the protection provided by Java and could cause problems due to ill-formed class files.
-Xverify:none