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

Memory statistics within the debug menu contain some unnecessary spaces

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 23w51a
    • 1.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
    • None
    • Confirmed
    • Debug
    • Low
    • Platform

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

        1. MC-252409.png
          1.35 MB
          [Mod] Avoma
        2. MC-252409 - Analysis.png
          158 kB
          [Mod] Avoma
        3. unknown.png
          316 kB
          Sculk man

            Fantastime [Mojang] Maxime Lebrot
            Avoma [Mod] Avoma
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: