code-server: [Bug]: Memory leak?

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS, ChromeOS
  • Remote OS: Ubuntu 20.04, 22.04
  • Remote Architecture: x86-64
  • code-server --version: 4.2.0, 4.3.0

Hi,

The memory consumed by the code-server (node) process gradually increases over time, regardless of whether and how the IDE is used. I have tested it multiple times and it has eventually used up all the 8GiB RAM of the server machine in a matter of 2 or so weeks.

Is this a well-known problem? Can I solve it permanently instead of rebooting the sever each time?

Many thanks

Steps to Reproduce

  1. Install code-server and run its daemon
  2. Continually measure memory usage of the process
  3. Wait ๐Ÿ˜ƒ

Expected

The memory usage should not be monotonically increasing

Actual

It is

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code?

  • I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

I also thought to temporarily increase the Cloud Memory from 4GB to 8GB.

My โ€œsolutionโ€ was adding a line to crontab to restart code-server every 24 hours ๐Ÿ˜†

Have you tried messing with the extensions? That also produced a solution for me ๐Ÿ˜ƒ)

Iโ€™d rather wait for an official fix. But which extension? ๐Ÿ˜„

Volar Extension used about 700MB per instance in my case. It also felt like it did still run in the background after closing an workspace.

Oh, sorry. I just found that the memory usage inside docker container and outside is not same, and the difference can be large. In container, use free -h get used + cached can be 7GB, but outside container, use docker stats containerID, show 1GB / 7GB.

@jsjoeio Thanks, i will look into it!

Side note: this would be a fun problem to solve. Iโ€™m not sure how, but Iโ€™m sure there are tools we could use to figure it out.

https://www.npmjs.com/package/heapdump?

Does this also happen with native VS Code?

No. I have VSCode continually open on a MacBook for weeks and never had a memory issue. Same for a ChromeOS device.