Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-129492

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


    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.13
    • Minecraft 18w19b, Minecraft 18w20a, Minecraft 18w20c, Minecraft 18w21a, Minecraft 18w22b, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre5, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9
    • Confirmed
    • Creative

      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.


      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 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

        1. 2018-05-18_00.49.32.png
          1.28 MB
        2. crash.jpg
          124 kB
        3. crash 2.jpg
          crash 2.jpg
          37 kB
        4. crash-2018-05-24_13.54.47-server.txt
          4 kB
        5. crash 3.jpg
          crash 3.jpg
          117 kB
        6. g13.zip
          3 kB
        7. MC-129492-win10-gameoutput-1.PNG
          547 kB

            Unassigned Unassigned
            kiddailey kiddailey
            55 Vote for this issue
            26 Start watching this issue