Mojira Archive
MC-252409

Memory statistics within the debug menu contain some unnecessary spaces

The Bug:

Memory statistics within the debug menu contain some unnecessary spaces.

See MC-252409 - Analysis.png for all occurrences of this issue.

Steps to Reproduce:

  1. Enable the debug menu by hitting the "F3" key.
  2. Look towards the top right of the debug menu and look closely at the memory statistics.
  3. Take note as to whether or not memory statistics within the debug menu contain some unnecessary spaces.

Observed Behavior:

Unnecessary spaces are present.

Expected Behavior:

Unnecessary spaces would not be present.

Code Analysis:

Code analysis by [Mod] Avoma can be found below.

The following is based on a decompiled version of Minecraft 1.19 Release Candidate 1 using Mojang mappings.

net.minecraft.client.gui.components.DebugScreenOverlay.java
public class DebugScreenOverlay extends GuiComponent {
   ...
   protected List<String> getSystemInformation() {
      ...
      ArrayList arrayList = Lists.newArrayList((Object[])new String[]{String.format("Java: %s %dbit", System.getProperty("java.version"), this.minecraft.is64Bit() ? 64 : 32), String.format("Mem: % 2d%% %03d/%03dMB", l4 * 100L / l, DebugScreenOverlay.bytesToMegabytes(l4), DebugScreenOverlay.bytesToMegabytes(l)), String.format("Allocation rate: %03dMB /s", DebugScreenOverlay.bytesToMegabytes(this.allocationRateCalculator.bytesAllocatedPerSecond(l4))), String.format("Allocated: % 2d%% %03dMB", l2 * 100L / l, DebugScreenOverlay.bytesToMegabytes(l2)), "", String.format("CPU: %s", GlUtil.getCpuInfo()), "", String.format("Display: %dx%d (%s)", Minecraft.getInstance().getWindow().getWidth(), Minecraft.getInstance().getWindow().getHeight(), GlUtil.getVendor()), GlUtil.getRenderer(), GlUtil.getOpenGLVersion()});
      ...

If we look at the above class, we can see that memory statistics within the debug menu contain some unnecessary spaces. This is evident through the following pieces of code:

... String.format("Mem: % 2d%% %03d/%03dMB" ...
... String.format("Allocation rate: %03dMB /s" ...
... String.format("Allocated: % 2d%% %03dMB" ...

Fixed

[Mod] Avoma

[Mojang] Maxime Lebrot

2022-06-02, 11:01 AM

2023-12-12, 09:22 AM

2023-12-12, 09:22 AM

3

6

Confirmed

Low

Platform

Debug

1.18.2 - 1.20.3 Release Candidate 11.18.2, 1.19 Pre-release 5, 1.19 Release Candidate 1, 1.19 Release Candidate 2, 1.19, 1.19.1 Pre-release 1, 1.19.1 Pre-release 2, 1.19.1 Pre-release 5, 1.19.1 Release Candidate 2, 1.19.1, 1.19.2, 22w45a, 1.19.3, 1.19.4, 1.20.1, 1.20.3 Release Candidate 1

23w51a