mojira.dev
MC-105845

Memory usage graph of server GUI not drawing

The bug

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

[media]

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();
}

Attachments

Comments 2

Why is this marked as "Won't fix"?

Then at least remove the following:

  • net.minecraft.server.gui.StatsComponent.paint(Graphics)

  • net.minecraft.server.gui.StatsComponent.values

  • net.minecraft.server.gui.StatsComponent.vp

  • repaint() call of net.minecraft.server.gui.StatsComponent.tick()

@unknown, for a short moment I thought your behaviour regarding closing reports changed :/

Please at least comment "Will be removed" and then I at least know why it was closed, because I am pretty certain that leaving kind of dead code is not "Won't fix"

Marcono1234

Erik Broes

Confirmed

GUI, memory, server

Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w41a

Minecraft 16w42a

Retrieved