Sublime Forum

Fontconfig fonts.conf causes 1Gb/sec memory leak

#1

Hello, a few days ago I wanted to try out upgrading to Sublime Text 4. Pretty soon after downloading it, I tried to change the colorscheme with Preferences > Select Color Scheme and my computer started locking up. I found that the same thing happened with Preferences > Select Theme, and that if I watched htop I could see the resident set size increasing by about a gigabyte per second, until it reached 12 Gb and my laptop started swapping.

I am on Arch Linux. I downloaded different versions of the .pkg.tar.xz files on the Downloads page and could reproduce it with any Sublime Text 4 version, but never in ST3.

By creating a new user, I saw that the issue didn’t appear with a clean $HOME.

I used strace() to find out which files were being opened, and copied them to a /tmp/subl directory that I could set my HOME variable to. Then I started removing subdirectories in /tmp/subl until the problem went away. The culprit turned out to be this configuration file:

~/.config/fontconfig/fonts.conf

with the following contents:

<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Fira Mono</family>
      <family>Noto Sans Mono</family>
    </prefer>
  </alias>
  <match target="font">
    <test name="family" compare="eq">
      <string>Fira Mono</string>
    </test>
    <edit name="pixelsize">
      <double>18</double>
    </edit>
  </match>
</fontconfig>

Hopefully this bug can be fixed? (If my fontconfig file is technically invalid, I’d love to know that too.)

0 Likes

#2

I can’t reproduce this on my system; this is likely a bug in one of our dependencies. Does it happen for other GTK3-based apps?

0 Likes