Skip to content

Certain task output causes excessive memory use #155134

Closed as duplicate
Closed as duplicate
@joshbolduc

Description

Type: Bug

Repro steps:

  1. Clone and open this reproduction repo (assumes node/npm installed and in your PATH): https://github.com/joshbolduc/vscode-task-memory-leak
  2. Run npm install
  3. Command palette -> run task -> start storybook -> continue without scanning the task output
  4. As soon as the task starts executing, shrink the terminal pane width so that the webpack output wraps. (There should be many lines of output printed rapidly; total output should be in the range of ~140,000 characters.)
  5. Observe memory usage of Code-related processes

Expect:
Memory usage is reasonable, no crash

Actual:
Memory usage rises rapidly and peaks at >2GB. Depending on task output, the window might crash due to OOM

For added context: I created the above repo based on an issue I encountered debugging an extension of mine. That extension creates a task using ProcessExecution that is similar to the task in the repo above. For whatever reason, on Windows, the task output when I create it via my extension always seems to wrap, resulting in many lines of output. (This is true even though, for the above repro, I have to shrink the window to induce the same behavior.) As a result, I see memory usage climb if I reveal the terminal being used to run the task. In my small test projects, this regularly results in an OOM crash.

This problem does not appear to happen:

  • if the same command is run via a shell in the terminal instead of as a task
  • if the task output (i.e., the progress messages from webpack) does not wrap (i.e., skip step 4)
  • If the task output remains hidden
  • if the task is not configured as a background task, in the repo above
    • My extension does configure the task as a background task. I tried changing it to not run as a background task as a possible workaround. I noticed that while memory usage initially seemed stable, after a little while the task output would appear to stall and memory usage would rapidly increase as before.
  • on macOS (at least using my test projects on my machine, I can't get the output to wrap and it finishes building too quickly)

VS Code version: Code - Insiders 1.70.0-insider (052d5b0, 2022-07-13T05:16:18.401Z)
OS version: Windows_NT x64 10.0.19044
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (8 x 3411)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.71GB (3.82GB free)
Process Argv --crash-reporter-id 80d4f634-4fbe-40d1-8223-a2a5cb69e82f
Screen Reader no
VM 29%
Extensions: none
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
pythonptprofiler:30281269
vsdfh931:30280409
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
wslgetstarted:30449409
vscscmwlcmt:30465136
cppdebug:30492333
pylanb8912:30522163
vsclangdf:30492506

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugperftasksTask system issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions