Dart-Code: Code Helper continuously runs at 400% CPU

Issue Type: Performance Issue

May have started in the latest VSCode version.

Code Helper occasionally spikes to up to 400% CPU and entire system / VS Code is unresponsive.

Extension version: 3.0.1 VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:22:55.268Z) OS version: Darwin x64 18.5.0

System Info
Item Value
CPUs Intel® Core™ i7-6920HQ CPU @ 2.90GHz (8 x 2900)
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: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 8, 6, 8
Memory (System) 16.00GB (0.47GB free)
Process Argv packages/dashcam
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
   19	    98	 36447	code main
    0	    98	 36448	   gpu-process
    0	    82	 36449	   window (dashcam.dart — dashcam)
    0	    33	 36452	     extensionHost
    0	    33	 36456	       /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/dart /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --client-id=Dart-Code.dart-code --client-version=3.0.1
    0	     0	 36457	       bash /Users/ened/dev/flutter/bin/flutter daemon
    0	    49	 36473	         /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/dart /Users/ened/dev/flutter/bin/cache/flutter_tools.snapshot daemon
    2	     0	 95528	           /bin/bash /Applications/Xcode.app/Contents/Developer/usr/bin/simctl list --json devices
    0	    33	 95529	             /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -runFirstLaunch
    0	    33	 36453	     watcherService
    0	    66	 36484	   shared-process
    0	   279	 43251	   window (dashcam_listener.dart — com.company.app)
    0	  2916	 43259	     extensionHost
    0	   508	 43263	       /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/dart /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --client-id=Dart-Code.dart-code --client-version=3.0.1
    0	     0	 43264	       bash /Users/ened/dev/flutter/bin/flutter daemon
    3	    49	 43279	         /Users/ened/dev/flutter/bin/cache/dart-sdk/bin/dart /Users/ened/dev/flutter/bin/cache/flutter_tools.snapshot daemon
    0	    66	 43260	     watcherService
    0	    49	 43262	     searchService
    0	     0	 86131	     /bin/bash -l
    0	    82	 95516	   window (Issue Reporter)
    0	     0	 95530	   /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
Workspace Info
|  Window (dashcam_listener.dart — com.company.app)
|  Window (dashcam.dart — dashcam)
|    Folder (com.company.app): more than 26356 files
|      File types: xml(5478) flat(4601) json(2557) png(2186) h(1629) jar(984)
|                  dart(703) plist(569) m(458) swift(439)
|      Conf files: cmake(21) launch.json(11) settings.json(5) makefile(2)
|                  package.json(1)
|    Folder (dashcam): more than 21084 files
|      File types: class(2774) flat(2760) xml(2346) swift(1447) dex(1308)
|                  jar(1108) png(971) json(962) dart(762) h(539)
|      Conf files: launch.json(11) settings.json(6);

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@ened I found a serious memory leak in VS Code recently, which may have contributed to this issue. It’s been fixed by the VS Code team and is shipping in v1.35 (which I believe is planned to release tomorrow - but I don’t know if it’ll slip).

https://github.com/microsoft/vscode/issues/74446

Please let me know if you’re still seeing perf issues on that release.

Thanks for the traces! I had a look through, and it didn’t look too bad except for an instance showing around half a second being spent converting completions (we seem to be doing a lot of work, and the garbage collector seems to be running many times too):

Screenshot 2019-05-14 at 11 52 29 am

It’s possible the garbage collector is running because we’re generating a lot of objects, but I also wonder if it’s running more frequently because you don’t have a lot of RAM (I can’t find anything online documenting what triggers GC in V8 to confirm this).

Could you try disabling the auto-import completions (with the dart.autoImportCompletions) and see whether it seems to make any significant difference?

It would be useful to try and get a profile of the Dart extension when this happens (run Show Running Extensions, select Dart then click the Start Profiling Extension Host button, let ot run for a while, then stop it and save it).

0.33GB available RAM (I have seen the number go as low as 0.02GB).

Having so little available memory is probably not going to help performance (it may result in a lot of paging) so I’d also use your OSes task manager/resource monitor to see if you have anything running consuming lots of RAM unnecessarily (the extension host here is using 2GB which isn’t great, but is still a long way off 16GB).