Sublime Forum

Huge memory leak associated with Shellcheck freezes computer completely

#1

Good evening,

I hope it’s my fault, not Sublime Text’s (ST4 build 4200, unregistered version), because it started quite recently. I’m working on a personal Bash/Shell project, which is roughly 2-3K lines of code, with all the Shell scripts open.

In the system monitor, I can see a lot of running shellcheck processes consuming hundreds of megabytes each. I had to pkill -15 shellcheck to stop the memory heap…

I also tried this tip from Github, but it still fails miserably. Disabling hardware acceleration in settings doesn’t help either.

My specs:
Operating system: Pop!_OS 24.04 Cosmic
Linux kernel: 6.17.9
Shellcheck: 0.11.0

Plugins:
Dracula Color Scheme
GitHub Theme
LSP
LSP-bash
LSP-json
Package Control
Solarized Color Scheme
SublimeLinter
SublimeLinter-shellcheck

Settings:
{
“added_words”: [
“shellcheck”,
“https”,
“github”,
“jsonschema”,
“coreutils”,
],
“caret_style”: “phase”,
“color_scheme”: “Mariana.sublime-color-scheme”,
“dark_theme”: “Adaptive.sublime-theme”,
“dictionary”: “Packages/Language - English/en_GB.dic”,
“font_face”: “JetBrains Mono”,
“font_size”: 11,
“hardware_acceleration”: “opengl”,
“highlight_line”: true,
“hot_exit”: “only_on_quit”,
“index_files”: true,
“light_theme”: “Default Dark.sublime-theme”,
“remember_workspace”: true,
“save_on_focus_lost”: true,
“spell_check”: true,
“theme”: “GitHub Adaptive.sublime-theme”,
“translate_tabs_to_spaces”: true,
“trim_trailing_white_space_on_save”: “all”,
“ignored_packages”: [
“Vintage”,
],
}

Thank you!

Rustam

0 Likes

#2

According to the plugins list it is most likely SublimeLinter-spellcheck plugin, which likely executes external spellcheck process after each modification of your script. If it doesn’t finish, maybe because it gets stuck on what it is fed with, you’ll likely end up with dozens of hanging processes.

ST uses hunspell library for spellchecking, which doesn’t rely on external processes.

0 Likes

#3

Thank you for trying to help! Indeed, spellcheck is executed on each action that require ShellCheck validation. Previously, it disappeared (got killed) from the process stack right after finishing its job.

So to somehow influence this process, I deleted (i.e., relocated) my personal ST4 stuff from .config and .cache directories and restarted the package installation process anew. I may be wrong but my initial investigation shows the following two lines as the cause of the problem, which doesn’t manifest itself after the LSP package (not LSP-bash) and these lines got removed:

// Settings in here override those in "LSP-bash/LSP-bash.sublime-settings"
{
	"bashIde.shellcheckPath": "/hardcoded/path/to/shellcheck", // a similar setting has already been defined inside `SublimeLinter-shellcheck` settings file anyway, so this one seemed redundant
	"bashIde.includeAllWorkspaceSymbols": true,
}
0 Likes

#4

Ah. I’ve read it as “spell-check” not noting it is actually “shell-check” :blush:

But the issue is the same. If that checker gets stuck on your script for a reason, it probably leaves zombie processes behind. Debugging probably requires manually calling shellcheck for specified file and analyze output.

It probably doesn’t make sense to use both, SublimeLinter and LSP to run shellcheck at the same time.

0 Likes

#5

The issue was solved after reinstalling all the packages but LSP. The original idea was to use it as a formatting tool for Shell scripts. But after identifying the conflicting settings above, I decided to replace it with another one, Pretty Shell. And now ST4 works with no issues at all.

Thank you for your tips!

0 Likes