mojira.dev
MC-129492

Moving through world gradually uses up all memory, causes stuttering and crash

Simply moving through the world gradually uses up all allocated memory and eventually causes the game to stutter and become unplayable as it struggles to free RAM. Sometimes the game crashes as a result.

Although my reproduction steps below mention Creative Mode, this also happens in Survival. Creative Mode merely allows recreation of the issue more quickly/easily.

To Reproduce

  1. Create a new world/creative mode (default)

  2. After spawning, toggle the debug screen on

  3. Fly up into the sky a fair amount

  4. Begin sprint-flying in a single direction

  5. Continue flying straight while watching the memory usage

Alternatively, instead of traveling straight, you can reproduce the issue by simply flying in a large enough square that chunk loading/unloading is actively taking place while traveling. In my tests, I used 800 blocks square.

Memory usage appears normal at the start (in my environment 40-60%), but over time the max percentage that is being used slowly increases and eventually peaks in the 90-98% range where the game can no longer operate smoothly and may crash.

In my environment, this is 100% repeatable and I have tested this with the following world types. After the indicated blocks traveled, allocated RAM hits 100%, memory usage reaches and/or stays above 90% and the game soon begins to stutter dramatically as it tries to free up ram every few seconds.

  • Default ~1700 blocks

  • Amplified, No Structures, Peaceful ~2800 blocks

  • Superflat, Classic, Structures, Easy ~4600 blocks

  • Superflat, Classic, No Structures, Peaceful ~6700 blocks

  • Superflat, The Void ~7400 blocks

  • Default on Win10 ~4100 blocks

Please note above that the issue even occurs in a Void Superflat world with no (additional) blocks or entities, though it does take a bit longer to occur.

Allocating Additional RAM

Allocating more RAM to Minecraft only seems to minimally impact these results. In a freshly generated Default world with 2GB allocated to Minecraft, it only took ~2000 blocks for the issue to occur. In other words, an extra GB of RAM only gave me about 300 blocks (as compared to my earlier test) additional travel before the game had problems. Edit: It does seem that the pauses happen less-often with more RAM, but they still exist.

Render Distance

Unsurprisingly, changing the render distance to 2 chunks and then back up to 12 chunks, causes the RAM usage to temporarily drop down 40-50% (although allocation is still 100%), making this a potential workaround.

Older Versions

Also note that I see a similar issue in 1.12.2, so this isn't entirely new. However, when v1.12.2 peaks at 90%+ memory usage, it appears to cull about 30% each time, keeping it from getting too out of control. In the 18w19b snapshot it is much more pronounced and the game is unable to recover.

Game Output Log

I've attached a snapshot of the warnings and errors from the output of my Windows 10 test. Note that other than the "can't keep up" server thread errors, there is nothing else unusual. When the game does crash, no additional messages appear in the output. The game simply quits and/or JAVA reports that it has stopped working.

Video

I have included links to video illustrating the issue and to download the game files used in the video. The video begins with the generation of a new default world and then illustrates the same issue after loading the same world.

Video:

https://youtu.be/tGh9WvXV8fk

World:
http://www.mediafire.com/file/pt13bqdxsja59p5/New_World-.zip

Video Highlights:

  • At 02:35 you begin to see the game rubberband

  • At 02:41 the game begins to full-stop at is tries to clear RAM

  • At 03:35 I reload the world

  • At 04:53 The game crashes

Linked issues

Attachments

Comments 59

Although it would still be an issue deserving attention, for you to allocate 2 GB of RAM to minecraft, I'd bet it'd hide itself. This is my new and first account, so I hope I don't forget about this site and comment.

I did try that and forgot to mention it. Allocating more RAM does not remedy the issue significantly. An extra GB of RAM only gives me about 700 additional blocks before the issue occurs again. I'll update the description to reflect this information. Thanks for the reminder!

By the way, if you click the "Watch this issue" link near the top of the page, you'll get email notifications to remind you of any activity on this ticket 🙂

I'm having the same problem. The longer I fly around the more the game stutters and then eventually it crashes. The first 18w19b game I played in this seed crashed and now won't open again.

seed: -8300275442758179407

[media]

Just crashed again. And all I did since posting the above comment is fly around exploring. In previous snapshots I went out as far as 5000 x 5000 with no problems and nothing about my system has changed.

The grayed pic is when the game crashed. It just froze then the game shut off. The other pic is a shot of when I opened the game again.

I'm on Windows 10, PC.

[media]

Updated with information from testing performed on Windows 10 and attached a game output log screen capture showing warnings in console output.

49 more comments

I'm always generating a fresh, default creative world in the 1.13 versions with seed -9218963885634162416 (same seed as in the original report) for every test, and quitting the game completely between each test. 

 

Edit: Forgot to mention that I'm using bdm8's "g13" chunk loader (attached to bug report) for the tests.

Can also confirm that this seems to be fixed in 1.13. Flew 5000 blocks loading new chunks, Minecraft never used more than 40-60% of 1GB allocated RAM.

Ok, we consider this issue as fixed.

Pierrot Charles

Yes, this very annoying bug as been fixed 😊

The other day I was helping a friend troubleshoot the game after he just upgraded to 1.13.  It would launch, start and immediately freeze on him when he tried to load a world.  My hunch that the culprit was this bug was correct – the game was immediately using up all allocated RAM and freezing enough that he couldn't play the game.

 

His install was using the default settings (and a medium render distance), so the game was only being allocated 1GB.  Setting a custom JVM lanch string to allocate 4GB resolved the issue.

 

As I've mentioned above, I can concur with my own testing that it still is an issue with many (if not most) worlds I've tested in 1.13 with only 1GB allocated and a medium-high render distance and don't think it has been resolved completely.   In any case, it may be that the only remaining fix is to make the launcher allocated 4GB by default instead of 1GB.

kiddailey

(Unassigned)

Confirmed

memory-leak

Minecraft 18w19b, Minecraft 18w20a, Minecraft 18w20c, Minecraft 18w21a, Minecraft 18w22b, ..., Minecraft 1.13-pre3, Minecraft 1.13-pre5, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9

Minecraft 1.13

Retrieved