Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumes lots of memory over time (memory leak) #789

Closed
shawmanz32na opened this issue Feb 7, 2019 · 5 comments
Closed

Consumes lots of memory over time (memory leak) #789

shawmanz32na opened this issue Feb 7, 2019 · 5 comments

Comments

@shawmanz32na
Copy link

This was ported from microsoft/vscode/issues/50280 , recently closed with claims that the problem lies here. Please refer to that issue for more information and troubleshooting.

If a Java project is left open for an extended period of time (days), the Java process continues to eat memory, eventually running the machine out of memory and causing swaps on the hard drive. This memory usage is not properly reported by VS Code's metrics nor the Windows Task Manager. This is particularly dangerous because memory continues to be consumed even when just sitting idle - I can leave my computer on with VS Code running with barely any memory usage, and come back a day or so later to my computer swapping away. The only way I've found to free the memory is to restart VS Code, at which point the memory gets released. Here's a screenshot of my task manager as this happens (note the maxed memory and high hard drive activity before VS Code is closed):

image

While troubleshooting in the original issue, I ran code --status in this condition, and saw the following results:

Version:          Code 1.30.2 (61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8, 2019-01-07T22:54:13.295Z)
OS Version:       Windows_NT x64 10.0.17134
CPUs:             Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz (8 x 2694)
Memory (System):  31.93GB (4.03GB free)
VM:               0%
Screen Reader:    no
Process Argv:
GPU Status:       2d_canvas:                    enabled
                  checker_imaging:              disabled_off
                  flash_3d:                     enabled
                  flash_stage3d:                enabled
                  flash_stage3d_baseline:       enabled
                  gpu_compositing:              enabled
                  multiple_raster_threads:      enabled_on
                  native_gpu_memory_buffers:    disabled_software
                  rasterization:                enabled
                  video_decode:                 enabled
                  video_encode:                 enabled
                  webgl:                        enabled
                  webgl2:                       enabled
CPU %   Mem MB     PID  Process
    0       53   16048  code main
    0       70     856     gpu-process
    0       44    6288     shared-process
    0      185   26152     window (README.md - dss (Workspace) - Visual Studio Code)
    0       58    9968       extensionHost
    0       24   18504         "C:\Program Files\Java\jdk-11.0.1\bin\java" --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -jar C:\Users\KShaw\.vscode\extensions\redhat.java-0.37.0\server\plugins\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar -configuration C:\Users\KShaw\.vscode\extensions\redhat.java-0.37.0\server\config_win -data c:\Users\KShaw\AppData\Roaming\Code\User\workspaceStorage\4403e5d1f9f0a177b8b5c0bf7e2a0517\redhat.java\jdt_ws
    0        0   22596           console-window-host (Windows internal process)
    0        1   55284         electron_node server.js
    0        1  443080         "C:\Users\KShaw\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\KShaw\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain" --node-ipc --clientProcessId=9968
    0       13   24432       watcherService
    0        2  825408       C:\Windows\system32\cmd.exe /c start /wait C:\Windows\System32\cmd.exe
    0        4  429408         C:\Windows\System32\cmd.exe
    0       14  725908           console-window-host (Windows internal process)
    0       35  941224           electron_node cli.js
    0       53  549968             "C:\Users\KShaw\AppData\Local\Programs\Microsoft VS Code\Code.exe" --status
    1       47  342484               gpu-process
    0        9  947288         console-window-host (Windows internal process)
Workspace Stats:
|  Window (README.md - dss (Workspace) - Visual Studio Code)
|    Folder (dss-wiki): 145 files
|      File types: md(76) xml(20) svg(18) jpg(17) json(8) JPG(3) gitignore(1)
|                  png(1) tg(1)
|      Conf files:
|    Folder (dss-documentation): 222 files
|      File types: tex(83) def(28) csv(16) pdf(8) out(8) log(8) aux(8) toc(7)
|                  sty(7) lot(6)
|      Conf files:
|    Folder (dss): 1669 files
|      File types: jmod(420) so(144) md(133) class(74) java(58) properties(46)
|                  xml(43) policy(42) h(42) sh(32)
|      Conf files: launch.json(1) settings.json(1)
|      Launch Configs: java

Another user had suggested that we inspect the number of process handles to locate the offending process, and here's what Task Manager reported:

image

I can't provide much more information at the moment, but can collect more if instructed how.

Environment
  • Operating System: Windows 10
  • JDK version: 11.0.1+ (confirmed on 11.0.2)
  • Visual Studio Code version: 1.23.1+ (confirmed on 1.31.0)
  • Java extension version: 0.25+ (confirmed on 0.38.0)
Steps To Reproduce
  1. Open a Java project
  2. Walk away
@fbricon
Copy link
Collaborator

fbricon commented Feb 7, 2019

@shawmanz32na thanks for that report. What kind of java project did you open? Maven, Gradle, eclipse?

@snjeza wanna look at that one?

@snjeza
Copy link
Contributor

snjeza commented Feb 7, 2019

wanna look at that one?

@fbricon will do it.

@shawmanz32na
Copy link
Author

@fbricon @snjeza All my projects are multi-module Maven projects.

@snjeza
Copy link
Contributor

snjeza commented Feb 22, 2019

I can still reproduce the issue with JDK 11.

@snjeza snjeza reopened this Feb 22, 2019
@snjeza
Copy link
Contributor

snjeza commented Feb 23, 2019

Related issue eclipse-jdtls/eclipse.jdt.ls#936

@snjeza snjeza closed this as completed Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants