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

Obfuscated text consumes obscene amounts of memory due to adding thousands of symbols to the font atlases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.1, 1.21.2 Release Candidate 1, 1.21.4 Pre-Release 1
    • None
    • Confirmed
    • Performance

      Relates to MC-253502 and MC-277520.

      The bug

      "Obfuscated" text will cause the affected letters to switch to another random character every tick. This has the very undesirable side effect of cluttering the internal font atlases, which causes the game to take up a lot more memory than it needs to.

      How to reproduce

      1. Run this command five times:
        /tellraw @p {"text": "ⓝiltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltfn~∅𝏇iltf", "obfuscated": true}
      2. Press t so that you can see the chat history
      3. Leave the game running for as long as you like
      4. Press F3 and S

      Expected results

      Nothing special.

      Actual results

      The game freezes for considerably longer after pressing F3 and S. Checking the screenshots/debug folder will reveal that there are now several hundred files produced for the font atlas.

      How to fix

      For the "default" font, we could perhaps limit the valid characters shown in obfuscated text to those which are not in GNU Unifont (MC-134879). This would avert this problem for the vast majority of cases where obfuscated text is actually seen in-game.

      The issue would still remain if the font is set to "uniform" manually, so perhaps some system to get rid of old font characters or old, disused atlas files could also be implemented.

      Further notes

      I've attached a zip file of the results of leaving the game to run for 30 minutes. This barely comes under the 10MB limit.

        1. 2024-10-20_17.44.31.png
          225 kB
          Connor Steppie
        2. 2024-10-20_17.45.06.png
          259 kB
          Connor Steppie
        3. 2024-10-20_18.31.29.png
          247 kB
          Connor Steppie
        4. 2024-10-20_18.31.32.png
          249 kB
          Connor Steppie

            Unassigned Unassigned
            Awesoman3000 Connor Steppie
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: