VazkiiMods / crucial2

The best Minecraft Vanilla Style Modpack.
33 stars 26 forks source link

Sporadic memory usage presumably leading to garbage collection, potential memory leak? Massive frame-time spikes #335

Open Veginite opened 1 year ago

Veginite commented 1 year ago

I don't know what's causing this but memory usage is incrementing by 200-300 MB/s until the memory usage stat text on F3 debug turns yellow (around 65%), then presumably garbage collection is triggered freeing memory to 28% and the loop continues. I wouldn't mind if the entire game didn't freeze for ~250ms every 13-15 seconds once memory is freed. The loop-like behavior is the same in vanilla but doesn't cause the hangups and is several dozen times slower in terms of ramp-up. It's not like this immediately but takes a while to ramp up but once the game is at this state, the only way to prevent these frame-time spikes is by restarting the game.

I have given 6144 MB for the game to work with and I have monitored both my OS and hardware which have nothing to do with it.

My system is running on stock settings and I have no issues in any other game.

EDIT #1 25th Sep 2022: Seemed better initially but the same behavior -- give it 15-30 minutes and the spikes are back.

EDIT #2 29th Sep 2022: Microstuttering was caused by having V-Sync off. Turning it on causes periodical microstuttering to cease

CPU: i7 5820k GPU: GTX 970 RAM: 16GB DDR4

Veginite commented 1 year ago

Massive spikes were caused by improper settings. Xmx and Xms alongside G1GC fixed the big ones leaving the game with minor microstutters which I can live with. The arguments are as follows in case someone else is having problems as well:

-XX:+UseG1GC -Xmx8G -Xms8G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M

Veginite commented 1 year ago

Video recording of the behavior. Note the pattern between spikes and memory usage in the top-right corner of the video's 2nd half:

https://www.youtube.com/watch?v=d9enyMVY47Y

gooeymiddle commented 3 months ago

I just started playing Crucial 2 and have been experiencing this issue. I have tried allocating various amounts of RAM, messing with the render distance and graphics, and nothing has fixed it. Turning on V-Sync did not fix the issue either like it seems to have back in 2022. I have no trouble with any other game and vanilla Minecraft runs like a dream.

Monitoring my hardware while playing shows nothing out of the ordinary either.

My specs are: Ryzen 7 3700x RTX 3060Ti 32gb DDR4 (overclocked to 3600 MHz)