Город МОСКОВСКИЙ
00:05:43

ConcMarkSweepGC vs G1GC vs ShenandoahGC - Minecraft Java Garbage Collector

Аватар
Приложения Будущего
Просмотры:
31
Дата загрузки:
05.12.2023 09:24
Длительность:
00:05:43
Категория:
Лайфстайл

Описание

Minecraft 1.14.4 Forge with OptiFine and some other mods.
Options: -Xmx5120M -Xss1M
+DisableExplicitGC was used for better compare.
Video Setiings: Clouds/Rain/Fog/Stars Off.

ConcMarkSweep
Options: -XX:+UseConcMarkSweepGC
This GC consumes relatively less memory after loading the game and has less CPU load. The value of memory consumption gradually increases to the maximum allocated and then Full GC is performed, which takes up to 1s. ConcMarkSweep GC can be used to reduce the need for Full GC if 5GB or less memory is allocated.

G1
Options:
-XX:+UseG1GC
-XX:MaxGCPauseMillis=50
-XX:+UnlockExperimentalVMOptions
-XX:G1ReservePercent=20
-XX:G1NewSizePercent=20
-XX:G1HeapRegionSize=32M
This GC consumes slightly more memory than ConcMarkSweep after the game is loaded and has more CPU load. The "MaxGCPauseMillis" option has a default value of 4294967295. If you set the time to less than 1000, then the game will start to consume 2 times more memory when loading, because it does not have enough time to clean up when loading. With the option MaxGCPauseMillis=50, the performance of the game is similar to ConcMarkSweep, but the memory consumption is 2-3 times more. If you do not use this option, then it increases the interval of stopping the program, which reduces FPS Low 1% due to the micro freezes of the game that are related to Stop-the-World pause. Unlike ConcMarkSweep, this GC performs a more complete garbage cleanup, which reduces the need to perform a Full GC, but this is not always the case, because when using the option "MaxGCPauseMillis=50" the value of memory consumption increases, which increase the need for Full GC. G1 GC can be used if 6-10GB of memory is allocated.

Shenandoah
Options: -XX:+UseShenandoahGC (available in OpenJDK 11).
This GC consumes a lot of memory but it gives more performance for the game. When using it, sometimes the micro freezes of the game can be greater than even on the G1, but it does not affect FPS Low 1% much. This GC always consumes the maximum amount of memory allocated. When exceeding the amount of memory that the game actually consumes (the maximum amount of memory consumption in the case of G1), the performance decreases more compared to G1. Shenandoah GC can be used if more than 5GB of memory is allocated, or even more than 10GB if there are a lot of mods.

Рекомендуемые видео