Skip to content

Conversation

@maschwenk
Copy link
Contributor

@jakebailey
Copy link
Member

@maschwenk I think I want to try to get this in, just so we can have people try this and see how it behaves.

The current code looks fine, though it requires a merge from main.

@maschwenk
Copy link
Contributor Author

@jakebailey on it!

if (goMemLimit) {
// Keep this regex aligned with the pattern in package.json.
if (!/^[0-9]+(([KMGT]i)?B)?$/.test(goMemLimit)) {
this.outputChannel.error(`Invalid goMemLimit: ${goMemLimit}. Must be a valid memory limit (e.g., '2048MiB', '4GiB'). Not overriding GOMEMLIMIT.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't unset goMemLimit

Copy link
Contributor Author

@maschwenk maschwenk Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d62cbcd

pulled out into a little helper to avoid having to do a bunch of weird nested conditional stuff and then don't need to "unset" anything, just set it once it's validated.

also figure at some point there might other env mutations that need to go on for other Go env vars, and might be easier to reason about if all that env configuration is done in one method

@maschwenk maschwenk changed the title Add option for overriding GOMEMLIMIT (and maybe other options? let's discuss) Add option for overriding GOMEMLIMIT Dec 13, 2025
@maschwenk maschwenk changed the title Add option for overriding GOMEMLIMIT Add option for overriding GOMEMLIMIT Dec 13, 2025
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work, though it does not integrate with the restart command because it's resolved before the client is created and then .restart() provide no opportunity to update it.

It may be that we should instead move this code into a user preference in the server itself and then configure it there on the fly.

Unfortunately, in my own testing, I felt like the option probably hurt more than it helped. If I set it to something like 2GiB, then opening the main TS codebase would use 1.4G, when without the option it would use 600MB. Not sure what to make of that.

@jakebailey jakebailey added this pull request to the merge queue Dec 13, 2025
Merged via the queue into microsoft:main with commit 2046634 Dec 13, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants