Closed matejdro closed 2 years ago
You sure the args you had were put there by the Vivecraft installer? We use ParallelGC tuned for low pause times by default which works well for this application, and does not exhibit the behavior you describe (there's still a couple missed frames periodically, but not an obvious freeze, and I've definitely seen it use more than 1GB).
Also, there is absolutely no reason to give vanilla Minecraft 8GB of memory unless you're running a stupid high render distance or something.
Here is fpsVR chart with extra GC flags that Vivecraft adds:
-Xmx8G -Xms8G -XX:+UseParallelGC -XX:ParallelGCThreads=3 -XX:MaxGCPauseMillis=3 -Xmn256M
Note the right chart. Every couple of seconds there is a huge spike like this where a single frame takes 27+ms to render.
When I delete all flags but the Xmx, this spike disappears:
-Xmx8G
Also, there is absolutely no reason to give vanilla Minecraft 8GB of memory unless you're running a stupid high render distance or something.
Probably not, but free memory is a wasted memory so if I have bigger amounts of memory in my PC, I might as well use it.
This is with HP Reverb G2, running at 50% render scale, amounting to around 2160x2160 visible area.
That spike looks entirely nominal, and in my testing the default GC parameters on Java 8 are worse as they cause less frequent but particularly long pauses, which is frankly more annoying. Are you using something other than the JVM bundled with the Minecraft launcher?
I'm running
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
Located in the C:\Program Files (x86)\Minecraft Launcher\runtime\jre-legacy\windows-x64\jre-legacy\bin
. So I guess this is the bundled java.
That's weird, I don't recall Mojang updating the JVM. It's always been 1.8.0_51
. Well, whatever, 1.17 is using Java 16 so we'll be making ZGC the default there which just solves all these problems. Like I said, the default GC parameters collect at longer intervals, which gets rid of the almost rythmatic stuttering but instead causes longer freezes. The period depends on how much memory you allocate, but just throwing more memory at the problem is not a solution; ZGC is.
You can use ZGC now if you install Java 14 or newer separately and point the launcher installation it. Our installer even includes a nice convenient checkbox to set the right JVM arguments, and prompts you to select the correct Java 14+ executable if it hasn't been selected before for that particular installation. I highly recommend it, really does make the game run noticeably smoother.
With default Vivecraft 1.16.5 installation, Vivecraft seems to add bunch of GC-related flags into launcher's JVM options entry.
When playing with those default flags it seems like JVM is performing GC way too aggressively - Game has 8GB of RAM allocated, but it will never even use it past the 1GB since GC keeps very aggressively pruning it.
This causes frame drop every couple of seconds when game freezes momentarily due to GC.
Manually editing launcher entry and removing all flags but the Xmx flag (that gives the game more memory) fixes the issue.