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

Memory usage graph of server GUI not drawing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 16w42a
    • Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w41a
    • Confirmed

      The bug

      In earlier versions like 1.0 RC2 (server file) the Minecraft server GUI displayed the memory usage over time

      In the latest versions of the server the memory usage graph remains empty.

      The reason

      The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

      The reason for this is that the memory usage values are not stored in the array net.minecraft.server.gui.StatsComponent.values which is later used for drawing the graph. Therefor the values remain 0 and nothing is drawn.

      This could be fixed by adding the code which existed in 1.0 RC2 back to the method net.minecraft.server.gui.StatsComponent.tick():

      private void tick()
      {
          long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
          System.gc();
          this.msgs[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
          this.msgs[1] = "Avg tick: " + FORMATTER.format(this.mean(this.server.tickTimeArray) * 1.0E-6D) + " ms";
          
          // Added this line
          this.values[(this.vp++ & 255)] = ((int)(i * 100L / Runtime.getRuntime().maxMemory()));
          this.repaint();
      }
      

            grum [Mojang] Grum (Erik Broes)
            marcono1234 Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: