typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

take too much memory

Open maxired opened this issue 3 weeks ago • 11 comments

Type: Bug

tsgo seems fast on the CPU, but on my project here it take 17GB or ram. so my computer got to swap a lots, which by the end does not really make things faster

Extension version: 0.20251205.1 VS Code version: Code 1.106.3 (Universal) (bf9252a2fb45be6893dd8870c0bf37e2e1766d61, 2025-11-25T22:28:18.024Z) OS version: Darwin arm64 24.3.0 Modes:

System Info
Item Value
CPUs Apple M1 (8 x 2400)
GPU Status 2d_canvas: enabled
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_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 5, 5
Memory (System) 16.00GB (0.07GB free)
Process Argv . --crash-reporter-id f11069fd-fef5-42de-a66b-ff89cc739130
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
4f60g487:31327383
nes-set-on:31351930
6abeh943:31336334
cloudbuttont:31379625
todos-1:31405332
qwen_all_req:31402696
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31396818
use-responses-api:31390855
je187915:31401257
d5i5i512:31428709
ec5jj548:31422691
copilot-nes-oct-t:31418199
terminalsuggestenabled:31426255
cmp-ext-treat:31426748
cp_cls_c_966_ss:31426491
defaultvisibility:31426295
expandedtokens:31427242
c0683394:31419495
478ah919:31426797
ge8j1254_inline_auto_hint_haiku:31426888
fa76a614:31426880
5j92g670_sonnet:31426790
cp_jb_t_lixleitest:31428973
h0hdh950:31428394

maxired avatar Dec 05 '25 11:12 maxired

Do you have a repo where this reproduces?

jakebailey avatar Dec 05 '25 14:12 jakebailey

Do you have a repo where this reproduces?

i have the same issue with https://github.com/oven-sh/bun/

abelcha avatar Dec 07 '25 23:12 abelcha

This codebase isn't in JS, so the runtime you use to run it cannot be the problem

jakebailey avatar Dec 07 '25 23:12 jakebailey

This codebase isn't in JS, so the runtime you use to run it cannot be the problem

Its majority zig but theres still 10% js/ts code, a package.json at the root etc

i found a way to fix this the memory issue in settings "typescript.tsserver.experimental.useBundledNode": false,

i can reproduce it back and forth so tell me if you need some traces or logs or something

abelcha avatar Dec 07 '25 23:12 abelcha

thanks @abelcha for the suggestion, I will try this settings !

@jakebailey sorry I am working on a private repo. what can I tell you is that is is a rather complex repo using typescript references on 5/6 projects, with at least 2 levels of references

maxired avatar Dec 08 '25 17:12 maxired

That setting does not apply when using the native preview extension. Node is never involved in launching the language server in the new codebase. If that setting matters, I don't think you have tsgo enabled.

jakebailey avatar Dec 08 '25 17:12 jakebailey

@jakebailey what I can also tell you is that when I was using node, I had a typescript.tsserver.maxTsServerMemory to 3GB. Is there a similar setting for tsgo ?

maxired avatar Dec 08 '25 17:12 maxired

No, there is no equivalent to that. #1808 perhaps.

jakebailey avatar Dec 08 '25 17:12 jakebailey

@jakebailey thanks.

I do confirm that running vscode with the GOMEMLIMIT variable set works. After a quick walk within my project even setting it to 2048MiB seems to be enough in my case. I'll let you know in case I see crashes or more

maxired avatar Dec 08 '25 17:12 maxired

Actually even with GOMEMLIMIT=2048MiB, after half a day working, my tsgo would eat 13GB of ram, while I have only 6 files opened in vscode

maxired avatar Dec 09 '25 10:12 maxired

That setting does not apply when using the native preview extension. Node is never involved in launching the language server in the new codebase. If that setting matters, I don't think you have tsgo enabled.

i swear, maybe its a cursor issue, heres the process samples normal VS with useBundledNode on and off

Image

cursor-tsgo-sample-500m.txt cursor-tsgo-sample-30g.txt

abelcha avatar Dec 09 '25 17:12 abelcha