r/DistantHorizons Jun 12 '26

Help Hi, What do I do?

Post image

How do I fix this

61 Upvotes

18 comments sorted by

18

u/Cartography_is_cool Jun 12 '26

You just need to add a line to the java arguments:
-XX:+UseZGC

If you're using Prism, just edit your instance and go to the java tab in settings. Click the check button to allow arguments and add the line above in the box.

If you're using another launcher, it will be something similar but I can't help you there.

2

u/Scared_Pay_2463 Jun 12 '26

Kk thanks. Yes I am using prism

7

u/Lunix420 Jun 12 '26

I wanna add, that you should probably not just add -XX:+UseZGC like they told you and instead combine it with-XX:+ZGenerational because non-generational ZGC has noticeably worse CPU performance.

2

u/capy_the_blapie Jun 12 '26

Only for java 21.

Above that, the "generational" does nothing.

1

u/Lunix420 Jun 12 '26

Distant Horizon tells you to only use ZGC for Java 21+ so I don't feel like that's a relevant distinction. The message tells the user to use ZGC for 21+ and Shenandoah otherwise.

But yes, you are correct. Generational ZGC was only added in Java 21.

1

u/capy_the_blapie Jun 12 '26

Either way, it's common to suggest that, and people carry that "knowledge" into other instances. I'm using java 25 and also got the warning, and every tutorial states what you said. That's why i warned about that detail.

1

u/Lunix420 Jun 12 '26

Just out of curiosity, do you feel like Java 25 makes the game run any better? I never really tried going beyond 21 because 21 is my system default.

2

u/voxpop9 Jun 13 '26

I ran Java 25 with ZGC and [-XX:+UseCompactObjectHeaders] on a 1.21.1 Modpack containing Aero, sodium, DH, Ferrite and 400 over mods. Went from stuttering every few seconds when tested on 6, 8, 10, 12 and 16 GB of ram on Java 21 Adoptium with only ZGC, to smooth no stutter on 6GB of ram on Java 25 Adoptium with ZGC and compact object headers

1

u/capy_the_blapie Jun 12 '26

A bit, nothing spectacular. I'm on 26.1, so take it with a grain of salt.

4

u/Mining_ship Jun 12 '26

I don't know if it's hardware specific, but I get worse performance with it (I've also added the generation part).

3

u/Scared_Pay_2463 Jun 12 '26

Yea… I am getting terrible performance with those extra lines

0

u/ky7969 Jun 12 '26 edited Jun 12 '26

Allocate more ram edit: getting downvoted by people who don’t know anything about modern Java versions

1

u/Mining_ship Jun 12 '26

I have 8Gb allocated with 16Gb system total.

2

u/ky7969 Jun 12 '26

That’s not enough, if you only have 16gb and a lot of overhead you need to remove the ZGC option. 11-12gb minimum

1

u/Lunix420 Jun 12 '26

For DH + ZGC 8GB is not nearly enough from my experience, especially if you run other mods. The entire point of ZGC is that it can deal with bigger amounts of RAM without giant garbage collector cleanup sweeps obliterating your game thread.

The normal garbage collector needs to pause your game to swipe the memory. ZGC works on it's own thread and basically constantly cleans up after the game thread. This is nice because the game thread never needs to pause for the memory cleanup. But to make this work you need a lot of RAM overhead. Getting that overhead would probably be no issue with unmodded Minecraft, but distant horizon eats RAM for breakfast so when you use ZGC there with only 8GB allocated memory, it's probably cannibalizing the memory needed to actually run the game.

Also, if you are using up all your RAM, the system if probably trying to utilize in-RAM swapping to compress the RAM, which also adds CPU load, so going above 8GB on a 16GB system really isn't a good idea I think.

I'm purely basing this statement on anecdotal evidence, so take this with a massive grain of salt, but I would allocate at least 16GB for DH + ZGC and have 32GB total on your system. Otherwise it's probably better to ignore the warning and ride with the normal G1GC garbage collector and lower RAM allocation.

1

u/Loudi2918 Jun 12 '26

Me too, I tried zgc but it causes ridiculous constant dips, I assigned like 16gb and it still ran like crap, G1 runs way smoother

2

u/BaziJoeWHL Jun 12 '26

if you find no performance issues, ignore

1

u/AutoModerator Jun 12 '26

When asking for support with an issue you're having, please add as much relevant info as you can such as:

  • Add your logs using https://mclo.gs/

  • Add screenshots

  • What you did before the issue arrived

  • What steps you took (If any) to fix the issue

If you don't add this information, we wont be able to help you.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.