python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

high Memory Usage (again)

Open cottrell opened this issue 5 years ago • 19 comments

Is this high memory usage expected? Is vscode collecting informatino about this? I feel like I've filled out quite a few feedback surveys. Is there something to switch to for python? Main thing we need is click through to definition.

image

cottrell avatar Apr 25 '20 20:04 cottrell

There should not be that many instances unless you have multiroot workspace with that many roots.

MikhailArkhipov avatar Apr 25 '20 20:04 MikhailArkhipov

The screenshot is from htop with threads shown (green lines); the above are threads of the same process.

jakebailey avatar Apr 25 '20 20:04 jakebailey

Yes, I should have mentioned that. There is only one process but with many threads (which I am not worried about). It's about 12G virtual and over 5G resident. It could be just that it is traversing many python librariers. But the way I use vscode this will always happen if it goes deep enough into my library. I'm guessing it is building some kind of index on the fly without spilling anything to disk? I'm not quit clear on what it would be holding in memory that is beyond what a normal IPython session would hold (which I also run important much of the same code).

cottrell avatar Apr 27 '20 06:04 cottrell

You used the question form; our bug form asks for a bunch more info that we'd need to figure out anything about what's going on. I suggest providing that info, which is mirrored here: https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue

jakebailey avatar Apr 27 '20 07:04 jakebailey

Still a bit odd there are that many threads unless analysis is still in progress and even then it should be limited to number of CPUs.

MikhailArkhipov avatar Apr 27 '20 16:04 MikhailArkhipov

As far as I know, this has sorta been the case for a while. For example, see the screenshot in #1755. IIRC we only limit the number of tasks, and to a multiple of the CPU count, but I don't think we're directly limiting the thread count anywhere unless I've missed something.

jakebailey avatar Apr 27 '20 17:04 jakebailey

The screens in that issue are from an issue I currently have with a couple of files that seems related to a circular import going on between the 2 of them. If I open other project or other files in the same project the LS never goes extremely high in memory usage or thread count, but opening these files, there are 3 of them haven't been able to determine if is a combination of them or simply one of them, makes my memory go high, thread count to spike, LS to become not responsive and sticks around after I close the VSCode client until I forcefully kill it.

CMLL avatar Apr 27 '20 17:04 CMLL

Right; I was just referring to the htop screenshot, not necessarily that they're related.

jakebailey avatar Apr 27 '20 17:04 jakebailey

From the issue screenshot and what I see on my end it could def be related. But that's just a theory.

CMLL avatar Apr 27 '20 19:04 CMLL

#1460 ?

MikhailArkhipov avatar May 01 '20 05:05 MikhailArkhipov

1

Memory leak.

  • PC physical memory is 32G.
  • never explicitly opened any .py file in VSCode since windows restart.
  • VSCode opened for a few days.
  • This memory leak is first time to appear in my PC.

System: Windows10 2004 VSCode About Information:

Version: 1.46.0-insider (user setup) Commit: 2591ede95a52400d5d22989b16706f9b8b4831da Date: 2020-05-22T21:13:15.709Z Electron: 8.3.0 Chrome: 80.0.3987.165 Node.js: 12.13.0 V8: 8.0.426.27-electron.0 OS: Windows_NT x64 10.0.19635

WilliamStone avatar Jun 04 '20 02:06 WilliamStone

I have similar experience. Definitely some kind of leak. Leaving an VS Code session open, but untouched over night or after some days can cause the whole computer to become unresponsive.

Running on Mac OS We have a large Python API wrapped around C++ code using SWIG.

No problem with fresh VS Code session, but deteriorates over time.

Have verified multiple occasions that Microsoft.Python.LanguageServer is what is eating all the memory.

koliyo avatar Jun 10 '20 06:06 koliyo

Try

"python.analysis.downloadChannel": "beta"

see of 0.5.51 is any better.

MikhailArkhipov avatar Jun 25 '20 21:06 MikhailArkhipov

I've been using the daily channel for some time. 0.5.51 doesn't seems to have any positive impact on the issue for me.

CMLL avatar Jun 26 '20 14:06 CMLL

On Ubuntu 18.04 also

ms-python-lang-serv-mem-usage

vj68 avatar Jul 15 '20 14:07 vj68

I would consider trying out our new LS, Pylance, to see if its performance characteristics work better for you.

jakebailey avatar Jul 15 '20 16:07 jakebailey

Try

"python.analysis.downloadChannel": "beta"

see of 0.5.51 is any better.

5.51 isnt any better. running on Ubuntu 18.04.3 LTS its eating my entire virtual memory space in under an hour ( 36gb ) it sits on "analyzing in background"

how do i disable?

mw-cyzen avatar Jul 31 '20 15:07 mw-cyzen

You can try Pylance server instead. It is an extension on marketplace.

MikhailArkhipov avatar Jul 31 '20 16:07 MikhailArkhipov

You can try Pylance server instead. It is an extension on marketplace.

ty, works as expected

mw-cyzen avatar Jul 31 '20 17:07 mw-cyzen