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

Any way to increase memory for VS code extension? #2725

Open
AndreasHald opened this issue Mar 27, 2025 · 8 comments
Open

Any way to increase memory for VS code extension? #2725

AndreasHald opened this issue Mar 27, 2025 · 8 comments

Comments

@AndreasHald
Copy link

My extension crashes with the following

Initialize language server at  file:///Users/xxx/Documents/eddystone
Initialize new ts service at  /Users/xxx/Documents/xxx/tsconfig.json
Trying to load configs for /Users/xxx/Documents/xxx
Loaded config at  /Users/xxx/Documents/xxx/svelte.config.js
SnapshotManager File Statistics:
Project files: 4063
Svelte files: 1099
From node_modules: 0
Total: 4063
SnapshotManager File Statistics:
Project files: 4063
Svelte files: 1119
From node_modules: 6146
Total: 10411

<--- Last few GCs --->

[59827:0x11800490000]    73638 ms: Scavenge (interleaved) 4062.2 (4076.4) -> 4058.6 (4076.4) MB, pooled: 0 MB, 2.08 / 0.00 ms  (average mu = 0.206, current mu = 0.108) allocation failure; 
[59827:0x11800490000]    73647 ms: Scavenge (interleaved) 4062.7 (4076.6) -> 4059.1 (4084.9) MB, pooled: 0 MB, 2.50 / 0.00 ms  (average mu = 0.206, current mu = 0.108) allocation failure; 


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0x11c8c8810 node::OnFatalError(char const*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x116ce0688 node::GetEnvironmentIsolateData(node::Environment*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x116ce061c node::GetEnvironmentIsolateData(node::Environment*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x116eb9b28 fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 5: 0x116f0c9e8 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x116efe380 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x116efe1d4 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x116f44178 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x11c936140 fontations_ffi$cxxbridge1$BridgeOutlineCollection$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x11c936494 fontations_ffi$cxxbridge1$BridgeOutlineCollection$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x116f1a0a8 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x116edefc4 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x116edc9d0 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x116ebbdec fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
15: 0x116ebb81c fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
16: 0x116ecf400 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
17: 0x116ecf2f0 v8::internal::StrongRootAllocatorBase::deallocate_impl(unsigned long*, unsigned long) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
18: 0x11770b67c cppgc::internal::AgeTable::ResetForTesting() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
19: 0x116eb745c fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
20: 0x116ead208 fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
21: 0x116e8c200 fontations_ffi$cxxbridge1$has_any_color_table [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
22: 0x11733dbd4 v8::internal::TickSample::print() const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
23: 0x157eafa74 
24: 0x150669998 
25: 0x15016d1ec 
26: 0x15069fc20 
27: 0x15050848c 
28: 0x1505d7c78 
29: 0x150147f50 
30: 0x1506684f8 
31: 0x1501489b4 
32: 0x150e609a4 
33: 0x150ac7550 
34: 0x15050a4a4 
35: 0x150e2a084 
36: 0x150e60934 
37: 0x150ac7550 
38: 0x15050a4a4 
39: 0x150150c94 
40: 0x150671090 
41: 0x15055f764 
42: 0x150680ecc 
43: 0x1505bfbe4 
44: 0x150672884 
45: 0x150af89fc 
46: 0x1505bd8ac 
47: 0x1500f0684 
48: 0x1505da34c 
49: 0x150ad9350 
50: 0x1505ceef8 
51: 0x15055a65c 
52: 0x1500f0508 
53: 0x1505da34c 
54: 0x1505745b8 
55: 0x1506717dc 
56: 0x15055f764 
57: 0x150680ecc 
58: 0x1505bfbe4 
59: 0x150672884 
60: 0x150af89fc 
61: 0x1505bd8ac 
62: 0x1500f0684 
63: 0x1505da34c 
64: 0x150676fd4 
65: 0x1506787ac 
66: 0x150be33f4 
67: 0x150ac2a70 
68: 0x1500f8658 
69: 0x15016bdc0 
70: 0x1505c7d44 
71: 0x150bfd9ac 
72: 0x1500f0080 
73: 0x1505da34c 
74: 0x150544688 
75: 0x1505447f8 
76: 0x150e2dfe0 
77: 0x1506a75f8 
78: 0x150659288 
79: 0x1500e269c 
80: 0x1500e342c 
81: 0x1505c245c 
82: 0x150ae4664 
83: 0x150e2de1c 
84: 0x1506a75f8 
85: 0x1505c7324 
86: 0x150be297c 
87: 0x150ac2a70 
88: 0x1500f8658 
89: 0x15016bdc0 
90: 0x150e28808 
91: 0x15016ba80 
92: 0x1505c7d44 
93: 0x150bfd9ac 
94: 0x1500f0080 
95: 0x1505da34c 
96: 0x150544688 
97: 0x1505447f8 
98: 0x150e2dfe0 
99: 0x1506a75f8 
100: 0x150659288 
101: 0x150bcf014 
102: 0x1500cf9fc 
103: 0x1506a75f8 
104: 0x1500e0dcc 
105: 0x1500d536c 
106: 0x15054aae0 
107: 0x1500ecd64 
108: 0x1505c2504 
109: 0x150ae4664 
110: 0x1500cf898 
111: 0x1506a75f8 
112: 0x1505f6320 
113: 0x1505f699c 
114: 0x1500c95f4 
115: 0x1500ca98c 
116: 0x157e0d624 
117: 0x1505ec830 
118: 0x1505ee788 
119: 0x1505e87b8 
120: 0x1505e3b9c 
121: 0x1500f0774 
122: 0x1505da34c 
123: 0x150676fd4 
124: 0x1506787ac 
125: 0x150be33f4 
126: 0x150ac2a70 
127: 0x1500f8658 
128: 0x1505c8834 
129: 0x1505c6470 
130: 0x1505c7d44 
131: 0x150bfd9ac 
132: 0x1500f0080 
133: 0x1505da34c 
134: 0x150afd368 
135: 0x150677570 
136: 0x1506786e8 
137: 0x150be33f4 
138: 0x150ac2a70 
139: 0x1500f8658 
140: 0x1505c8834 
141: 0x1505c6470 
142: 0x1505c7d44 
143: 0x150bfd9ac 
144: 0x1500f0080 
145: 0x1505da34c 
146: 0x150ad9350 
147: 0x1506408a0 
148: 0x1500f04c8 
149: 0x1505da34c 
150: 0x150adeb10 
151: 0x150adeee0 
152: 0x1500f07ec 
153: 0x1505da34c 
154: 0x150676fd4 
155: 0x1506787ac 
156: 0x150be33f4 
157: 0x150ac2a70 
158: 0x1500f8658 
159: 0x1505c8834 
160: 0x1505c6470 
161: 0x1505c7d44 
162: 0x150bfd9ac 
163: 0x1500f0080 
164: 0x1505da34c 
165: 0x1505745b8 
166: 0x1506717dc 
167: 0x15055f764 
168: 0x150680ecc 
169: 0x1505bfbe4 
170: 0x150672884 
171: 0x150af89fc 
172: 0x1505bd8ac 
173: 0x1500f0684 
174: 0x1505da34c 
175: 0x150676fd4 
176: 0x1506787ac 
177: 0x150be33f4 
178: 0x150ac2a70 
179: 0x1500f8658 
180: 0x1505c8834 
181: 0x1505c6470 
182: 0x1505c7d44 
183: 0x150bfd9ac 
184: 0x1500f0080 
185: 0x1505da34c 
186: 0x15069f688 
187: 0x1500f0548 
188: 0x1505da34c 
189: 0x150afd368 
190: 0x150677570 
191: 0x1506786e8 
192: 0x150be33f4 
193: 0x150ac2a70 
194: 0x1500f8658 
195: 0x1505c8834 
196: 0x1505c6470 
197: 0x1505c7d44 
198: 0x150bfd9ac 
199: 0x1500f0080 
200: 0x1505da34c 
201: 0x150ad9350 
202: 0x1505ceef8 
203: 0x15055a65c 
204: 0x1500f0508 
205: 0x1505da34c 
206: 0x1505745b8 
207: 0x1506717dc 
208: 0x15055f764 
209: 0x150680ecc 
210: 0x1505bfbe4 
211: 0x150672884 
212: 0x150af89fc 
213: 0x1505bd8ac 
214: 0x1500f0684 
215: 0x1505da34c 
216: 0x150676fd4 
217: 0x1506787ac 
218: 0x150be33f4 
219: 0x150ac2a70 
220: 0x1500f8658 
221: 0x1505c8834 
222: 0x1505c6470 
223: 0x1505c7d44 
224: 0x150bfd9ac 
225: 0x1500f0080 
226: 0x1505da34c 
227: 0x150544688 
228: 0x1505447f8 
229: 0x1500cf954 
230: 0x1506a75f8 
231: 0x15065912c 
232: 0x1500e269c 
233: 0x1500ed290 
234: 0x1505c2504 
235: 0x150ae4664 
236: 0x1500cf898 
237: 0x1506a75f8 
238: 0x1500e0dcc 
239: 0x1500d536c 
240: 0x15054aae0 
241: 0x1500ecd64 
242: 0x1505c2504 
243: 0x150ae4664 
244: 0x1500cf898 
245: 0x1506a75f8 
246: 0x15065912c 
247: 0x1500e269c 
248: 0x1500ed290 
249: 0x1505c2504 
250: 0x150ae4664 
251: 0x1500cf898 
252: 0x1506a75f8 
253: 0x15065912c 
254: 0x15055d0e8 
255: 0x1500cfa34 
[Error - 14:44:23] Server process exited with signal SIGABRT.
[Info  - 14:44:23] Connection to server got closed. Server will restart.
true

I know this is most likely related to excessive use of types and should probably be debugged why it's attempting to use so much memory, but in the meantime - is there anyway I can simply give the extension 8 or 16gb of memory?

@jasonlyu123
Copy link
Member

You could probably use the svelte.language-server.runtime-args config to increase the memory limit. But this is most likely a misconfiguration with your include and exclude config in the tsconfig.json. You need to exclude or not include the build outputs.

Normally, there should be a size check to prevent crashes; maybe you disabled it while debugging the size limit warning?

@AndreasHald
Copy link
Author

I don't think so? where would I have disabled it?

@AndreasHald
Copy link
Author

"svelte.language-server.runtime-args": ["--max-old-space-size=8192"]

This does not appear to work

<--- Last few GCs --->

[72221:0x10800490000]    74847 ms: Scavenge (interleaved) 4062.8 (4074.8) -> 4060.9 (4078.8) MB, pooled: 0 MB, 4.08 / 0.00 ms  (average mu = 0.221, current mu = 0.059) allocation failure; 
[72221:0x10800490000]    76267 ms: Mark-Compact 4065.1 (4079.5) -> 4061.0 (4076.8) MB, pooled: 4 MB, 1407.38 / 0.00 ms  (average mu = 0.103, current mu = 0.044) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

Still seems like it's crashing around 4gb

@jasonlyu123
Copy link
Member

jasonlyu123 commented Mar 27, 2025

I still think it is more likely to be a problem with your tsonfig.json. You need to check if the "include" config matches any build output. 4000 source files in a single project doesn't sound right.

@AndreasHald
Copy link
Author

After having investigated this further, I don't think this is a tsconfig issue, I can't find any build output as part of the tsconfig, it is quite a large project however.

I think the issue is downstream from this one https://x.com/arktypeio/status/1905293040064790541 ie a typescript issue when inferring types from in our case zod objects. We do this quite a lot.

While waiting for a resolution for this do you have any other suggestions for increasing the memory other than
"svelte.language-server.runtime-args": ["--max-old-space-size=8192"]

@jasonlyu123
Copy link
Member

If that is the case, it sounds like a typescript issue. Then you either have to report to TypeScript or ArkType. You might have to check when this started to happen, and maybe you can narrow down the files that might be the problem.

@AndreasHald
Copy link
Author

I agree, it's a typescript issue and it sounds like it's being worked on on the typescript side, so it'll most likely go away eventually, and you are right, I could fix it on my side by reducing our usage of type inference to reduce the typescript overhead. all that being said, it would be nice to be able to temporarily change the memory for the plugin, so it can still work while either waiting for a typescript fix or reducing our reliance on what's causing the issue.

@Axeldeblen
Copy link

@AndreasHald.
We also have a very large svelte project with ~8000 svelte files. I'm guessing there might be a memory leak in the last update to the extension because after looking at this a bit yesterday in our project it seems downgrading to the previous Svelte for VS code extension release 109.5.2 has resolved the issue for us.

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