mojira.dev
MC-62817

Lag over time, possibly memory leak

After several hours the game becomes less responsive(player movement gets choppy) and uses more memory. FPS seems unaffected and cpu usage never exceeds 35%. As I catch up on the changes in minecraft over the last few years I'm often running tests on mechanics in the background while sleeping or afk. In 1.7.9 and 1.7.10 and even 14w28b this never caused me issue. Even though I've allowed for up to 4gb of memory to be allocated the previous versions never exceeded 2gb allocated. In 14w29b, however, I have noticed that the overall memory usage will have doubled to tap at the 4gb consistently in about 8 hours time. Even if nothing of consequence is occurring in the world(which was last nights test). This may also be related to the visits from Herobrine(which causes an immediate jump in memory usage). However I'm leaning more towards memory leak. Oh, and this is in single player.

Update: the following Java 8 Arguments fixed this for me,

-Xmx1G -Xmn128M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseAdaptiveSizePolicy

Attachments

Comments 28

Please force a crash by pressing F3 + C for 10 seconds while in-game and attach the crash report ([minecraft/crash-reports/crash-<DATE>-client.txt|http://hopper.minecraft.net/help/finding-minecraft-data-folder]) here.

For whatever reason it wasn't quite as bad this morning. Maybe herobrine didn't stop by for a visit last night. Still some stutter in the movement, however, not nearly as bad. Plus memory usage was much lower than previous mornings. Although, still about 20% more memory actively being used than I am used to seeing. I'll keep tinkering around and see if I can't figure out the difference and get you a better report. In the mean time I'll upload this one.

For comparison this second crash report is what it is like when I first load the world.

One thing I have been playing with in the current snapshot that I've not before is the villager farming. After checking the world I ran last night over head to toe I found about 12 of 24 farmers I set up had gone inactive. They ran out of crops to plant at some point. It may be coincidental, yet, it is the only difference I can find between last night and previous nights.

You're using a lot of non standard JVM options:

-Xms2G -Xmx4G -XX:ParallelGCThreads=4 -XX:+UseG1GC -XX:MaxGCPauseMillis=500

How much RAM does you computer have ?
If you answer something less than 8 GB then reduce the Xmx.

You might remove the -XX one after each other and see if this has any impact on the lag.

Additionally you might upgrade to Java 8U11: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

18 more comments

This one takes some long testing that I just haven't felt up to for awhile. With the currently recommended and soon to be depreciated jvm gc settings each step takes at least a day. I will check it out again at some point. I've just had other more appealing interests as of late.

Long story short, yes its still an issue. Sorta. I didn't let it run long enough at either 1gb or 4gb to get you a useful crash report, but, I could see the same trend after 4 hours in each. Then I fixed it. I was so incredibly bored at one point that I started writing books for a map where I could fit everything in it in one screenshot. Then I started thinking about how changing the JVM Arguments to the ones recommended in this thread significantly improved the situation. So I went out and dug into all the latest options for Java 8 and came up with this simple set of arguments:

-Xmx1G -Xms128m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC

With these arguments my memory usage never rises above 350mb even after hours on a map that used to launch at 650mb with the default arguments. Its either fixed or swept so far under the rug I'll never see it again. After stitching together the various notes at Oracle that ParNewGC appears in, its apparently a slightly-tweaked multi-threaded drop-in-replacement for CMSIncremental. I tried tinkering with the various settings relevant to ParNewGC, yet, it seems to work best when left to its own devices.

Edit: I've found that with double the memory ParNewGC runs a tad faster and uses less memory. Likely due to an internal survivor optimization that I couldn't force otherwise. -Xmx2G -Xms256m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC

While the settings I listed previously worked fine playing normally, I have an automation script that pushes minecraft to its limits in the course of preparing a large section of the nether for a map idea I've been tinkering with. Them settings buckled when running it. So I tinkered with the jvm arguments awhile and remembered the one note from oracle that stated UseParNewGC as a "drop in replacement" for CMSIncrementalMode. So I tried dropping it into the default settings (-Xmx1G -Xmn128M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseAdaptiveSizePolicy) and its working pretty good even when I'm playing abnormally.

Is this still an issue in the current Minecraft Snapshot 15w47c or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

I cannot reliably test this or any other issue until MC-38134 is resolved. That said switching to UseParNewGC was a valid workaround/fix that I remember testing extensively. Thus, I doubt further testing is needed on this issue.

Someone 3x7

(Unassigned)

Unconfirmed

Minecraft 14w29b, Minecraft 14w30c

Minecraft 14w30b, Minecraft 14w30c

Retrieved