Vscode: tsserver.js Memory leak / CPU issue

Created on 28 Nov 2019  路  4Comments  路  Source: microsoft/vscode


  • VSCode Version: 1.40.2 / Insiders: 1.41.0
  • OS Version: Windows 7 (Also reproduced on Windows 10 and Fedora)

Steps to Reproduce:

  1. Open or Create a new typescript project. The bigger the better. A new angular project should suffice.
  2. Open taskmanager to monitor process ram usage. Take note of current RAM usage of process for tsserver.js
  3. Open a .ts file and type slowly. Make mistakes. Note that the RAM usage of tsserver.js increases (the bigger the project the faster it will increase). Note that the RAM usage never decreases even if you leave it running for a long time.
  4. At some point (I havn't been able to figure out what triggers this), it will suddenly balloon up in memory usage until it hits the maximum available RAM on the system. It will ignore the max_old_space_size setting. e.g. In my case whether I set it to 3072 or 300 when this issue happens it will rapidly use up 20.5Gb of RAM and 100% of a cpu core.


Does this issue occur when all extensions are disabled?: No, requires the TSLint extension (tested with v1.2.3)

Additional Notes:
Both regular and insiders editions have this issue.
VSCode 1.39.2 appears to be working correctly, I've been unable to reproduce. RAM usage will increase but never shoots up so rapidly and if left alone for a few seconds the GC will kick in and usage drops drastically.

It appears these issues might be related:

84326 - note the 98% RAM usage in screenshot)

84585 - Complaints about RAM, CPU and unresponsive autocompletion

There are a number of other issues mentioning VSCode being "slow" in the last few weeks which leads me to believe this issue is affecting quite a few devs.

*caused-by-extension

Most helpful comment

This issue should not be closed. The same version of TSLint works perfectly fine on older versions of VSCode which indicates the extension itself is unlikely the cause.

The change might be related to how VSCode starts a new process. The parameters passed to start the tsserver.js process have changed between 1.39.x and 1.40.x. 1.40.x now includes the parameter --max_old_space_size. Something in the implementation of that is likely the cause.

Even if the tslint extension has a bug, surely having --max_old_space_size=3000 would force it to crash with out of memory instead of using 22Gb of RAM?

All 4 comments

Saw similar issue in my setup also

Code Version: 1.40.2
OS Version: win 10

Screenshot (10)
Screenshot (9)

Please file this issue against the tslint extension since it seems to cause this

This issue should not be closed. The same version of TSLint works perfectly fine on older versions of VSCode which indicates the extension itself is unlikely the cause.

The change might be related to how VSCode starts a new process. The parameters passed to start the tsserver.js process have changed between 1.39.x and 1.40.x. 1.40.x now includes the parameter --max_old_space_size. Something in the implementation of that is likely the cause.

Even if the tslint extension has a bug, surely having --max_old_space_size=3000 would force it to crash with out of memory instead of using 22Gb of RAM?

I second what @hyarionh is saying, this issues should not be closed.

We had to downgrade all our machines to VSCode to 1.39.x, since this memory leak would freeze the entire OS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrkiley picture mrkiley  路  3Comments

villiv picture villiv  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

chrisdias picture chrisdias  路  3Comments

curtw picture curtw  路  3Comments