mojira.dev
MC-277733

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

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.

Linked issues

Attachments

Comments 0

No comments.

muzikbike

(Unassigned)

Confirmed

Performance

1.21.1, 1.21.2 Release Candidate 1, 1.21.4 Pre-Release 1

Retrieved