-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Ensure createProgram stops referencing rootNamesOrOptions to ensure oldProgram is GC'd #61034
Conversation
…ound JSC bug Co-authored-by: cplepage <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Thank you!! I also tried several other variations and this is the only thing that seems to work. Clearly a JSC bug, but it is severe enough that a workaround is warranted. |
Hmmm, actually, I have an idea... |
Aha, I found a more explainable fix. |
@typescript-bot pack this This fix is way more explainable. I only realized it after I sent the PR. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@typescript-bot perf test tsserver-only |
Wow nice find. |
@jakebailey Here they are:
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
This is practically the same as #58138, since that seems to be the only thing that works, along with some code to makecreateProgram
less likely to accidentally be changed such that this hack breaks something.This is still 100% for sure a JSC GC bug, but I cannot find any reasonable way to fix this besides the original proposed solution.The parameter
rootNamesOrOptions
holds a reference tooldProgram
; we force overwroteoldProgram
in the local scope, butrootNamesOrOptions
appears to stay in scope in JSC, so overwrite that too. That andcreateProgramOptions
also referenced the variable, so that has to also go.Fixes #58137