Repository navigation
Apparent memory leak #565
Description
Activity
limitless00net commented
on Jan 17, 2023 on Jan 17, 2023 · Hidden as duplicateshow commentMore actionsgithub-actions commented
on Feb 16, 2023 on Feb 16, 2023 · Hidden as resolvedshow commentMore actions- addedstaleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
on Feb 16, 2023 Just updated my Home Assistant addons and started experiencing issues with my home "lagging". After investigating the issue, I noticed that the Visual Studio addon consumed 95% CPU and 57% ram. Turning the addon off lowered the overall resource usage on my Home Assistant system. See attached pictures.

Reacted by Максим Петров, mniewiera, Ftown14 and Daniel ScharmachScottG489 commented
on Feb 20, 2023 on Feb 20, 2023 · Hidden as duplicateAuthorshow commentMore actions- removedstaleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
on Feb 21, 2023 I specifically started configuring the Terminal & SSH addon to be able to use VSCode Remote - SSH specifically because of this memory issue.
My theory is that with each loading of the VSCode web interface, it's spinning up a new process without killing the old one. I say this because judging by the memory footprint over time, I can see stark stepwise jumps of memory use.
@BNolet I've seen similar spike patterns as well and had also theorized that. I wonder if something changed recently with how new instances are being spun up.
I'm also considering using an external client, though I'll be using intellij instead. I've already got it working via sshfs.
Have any of you guys been experiencing random reboots because of this maybe? My HA install has been rebooting pretty frequently and couldn't find a culprit. I've started disabling add-ons and after I noticed (see #589 as well) VSS uses port 1337 which shows up a lot in the logs.
Reacted by Daniel Scharmach@VNRARA I've had to manually reboot my system because I ran out of memory, and soon after swap. Once everything starts swapping to disk the system essentially locks up.
I'd suggest enabling resource usage sensors for your add-ons. I've found it very valuable since I've done so. You can do this by going to the services created for each add-on and enabling the CPU and memory percent sensors.
I think both Node-Red and VSCode might be culprits here. (I'm on a 4GB system)
VS code is already using: +100mb RAM from boot and Node-Red +115MB.
This also sometimes happens:
[02:28:34] [172.30.32.2][c05a3361][ManagementConnection] Unknown reconnection token (never seen).
[02:28:34] [172.30.32.2][e68f3661][ExtensionHostConnection] Unknown reconnection token (never seen).
[02:34:01] [172.30.32.2][e9f8b661][ManagementConnection] New connection established.
[02:34:03] [172.30.32.2][aa78680f][ExtensionHostConnection] New connection established.
[02:34:03] [172.30.32.2][aa78680f][ExtensionHostConnection] <468> Launched Extension Host Process.I think a few hundred MB for either of those is more than acceptable.
Bringing this discussion back on topic though, I'd pay attention to sustained increases to the memory usage of VS Code as an indicator that you're also seeing a memory leak.
I have the same issue on my home assistant blue, after I disabled VSCode and didn’t use it anymore I didn’t have any reboots. When I used it heavily it crashed every half an hour.
123 remaining items
ScottG489 commented
on Oct 15, 2025 on Oct 15, 2025 · Hidden as resolvedAuthorshow commentMore actions- removedstaleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
on Oct 16, 2025 github-actions commented
on Nov 16, 2025 on Nov 16, 2025 – with GitHub Actions · Hidden as resolvedshow commentMore actions- addedstaleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
on Nov 16, 2025 - addedno-staleThis issue or PR is exempted from the stable bot.This issue or PR is exempted from the stable bot.and removedstaleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
on Nov 16, 2025 Upstream I've been able to implement a bunch of fixes / mitigations that should help as of the next release:
- Performance improvements and stackoverflow fixes: Performance improvements and stackoverflow fixes keesschollaart81/vscode-home-assistant#3916
- Adds symlink loop protection to prevent infinite recursion: Adds symlink loop protection to prevent infinite recursion keesschollaart81/vscode-home-assistant#3920
That should drastically improve CPU usage; and memory usage as a side-effect. For protection, I'm also modifying the add-on to prevent the use of the
/root folder as the workspace (which consumes a metric TON of memory if done that way).While not a full memory leak fix, it will mitigate the issue. I have a few places that potentially leak in the upstream vscode extension that I'm looking into.
../Frenck
Blogging my personal ramblings at frenck.dev
Reacted by bcutter, dcbr, Oliver Cervera and Daniel ScharmachPlease try the latest release: https://github.com/hassio-addons/addon-vscode/releases/tag/v6.0.0
I'm curious to learn if things improved.
../Frenck
Blogging my personal ramblings at frenck.dev
Reacted by Scott Giminiani and Oliver CerveraJust as a quick update on this: I've been occasionally taking a look at historical memory usage and comparing the before/after relative to the update. I don't really have anything conclusive to report yet. While I haven't seen any run-away usage like before, my usage of the add-on has been limited.
If anyone else can take a look at memory usage before/after v6 and provide their own feedback, that would be helpful :)
Edit: Another data point - my automation to restart VSCode if it's memory gets too high just triggered. It seemed to suddenly spike. I've disabled the automation for now so I can more easily track memory.
Reacted by Oliver Cervera and Daniel Scharmachhello
@ScottG489 i use vscode 6.0.1 on home assistant Yellow (raspi 4 4Go RAM) and i have a lot of HIGH memory and high CPU usage. On my side I have to reboot HA to recover CPU @ 15 to 18% and memory @ 50 to 55% (huge HA config this more than 400 template sensors and 100 zigbee hardware and about 60 integrations)
As a workaround and
- just in case I accidentally discover the increased memory usage after using Studio Code Server
- or I get a notification of my "80 % total system memory is in use, check situation" automation - triggered once a few days ago after years of silence
I restart the Studio Code Server addon. Pretty easy with the switches available for a few HA releases now.
Of course it would be much better if the Supervisor / addons internal mechanisms can take care of the addons memory hunger.
- Blue Studio Code Server addon memory usage
- Yellow system memory usage
Pretty obvious right.
Reacted by Daniel ScharmachIt's a bit tricky because you're running a full on and fairly heavy IDE application as an add-on. I don't think it's completely unexpected that it might have high memory usage. But it should not grow unbounded and perhaps should regulate itself to free up memory when not in use.
The problem from my observation must be somewhere in the session manager or something like this.
I mentioned this last year here in this very issue. I don't know if it got lost between the comments but it's here somewhere.
Anyway the way I found this was observation ofConnected Clientsto HA via:websocket_api: - platform: websocket_api name: Connected Clients unique_id: connected_clients
It was very strange when I noticed for the first time that I had so many clients (over 20) connected so I was counting every device or app which could be connected to my HA and still the number was not correct. However everything worked so I was thinking maybe the sensor just gives incorrect data and moved this issue for future debugging. Then I noticed few days later the RAM was completely consumed and started looking who or what is consuming all of it. Found the VSCode add-on as causer. Restarted it and then I saw also connected clients dropped to a number of 5 clients. It was clear that this number dropped exactly when VSCode was restarted.
So if you will observe this sensor together with VSCode RAM usage you will see both will start growing overtime you use VSCode. For example as already mentioned I had over 20 connected clients based on the sensor and RAM fully consumed. Once I restarted the add-on the RAM of course drops to 0.x% but also Connected Clients returns to correct value which in my case is 5. But the 15+ sessions were opened by VSCode somehow.
I am thinking a good explanation would be that new session is opened every time you access VSCode from a new browser tab for example and then once it's closed the session remains open. This would mean there is missing some session close trigger based on time of inactivity or it's there but has some problem. Maybe there should be also some function which will use the same session if you use the same browser on the same device but multiple tabs. IDK I am not a developer but this pointed me at least somewhere and tried to summarize my observation and thoughts here.
Maybe it will help us move closer to the solution. 😊
UPDATE: Fresh example few minutes old. You can see that drop at 10:18 in both sensors thats the spot I restarted VSCode. Unfortunatelly I am not tracking history of VSCode usage but overall RAM usage dropped by 10% and connected clients from 18 to 6.
Reacted by bcutter, dcbr, Oliver Cervera, Tom Carpenter, Metus88 and Daniel Scharmach- marked RAM usage increases every time I open and close a new tab #1102 as a duplicate of this issue
on Mar 11, 2026








Problem/Motivation
This addon increases in memory consumption until my system runs out.
I've been monitoring it since my last incident and I had to restart the host. The host has a total of 4GB of memory which meets the documented requirements.
Though I've only been tracking memory per-addon for the duration of the first graph, I have been running this addon for over a year and I've only been having memory usage issues recently:
I usually update addons pretty quickly after there's a release, and I can see v5.4.1 was released right around that time. Though from the release notes nothing sticks out.
I'm on the latest version and default config.
Expected behavior
For the memory usage of this addon to not increase indefinitely.
Actual behavior
Memory appears to increase indefinitely. Last time my system used up all memory and swap and locked up due to swap disk usage and I had to restart.
Steps to reproduce
As far as I can tell I'm using VS Code normally. I've only installed one extension (vim).
Unfortunately, I don't have any more information than above, but I'm happy to troubleshoot and get more information if you have suggestions on how to do so. I connected to the container and it doesn't have
psor evenfreeso it seems like my tooling in the container is limited.Thoughts on what this could be?