microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.48k stars 12.43k forks source link

Memory Leak disposing oldProgram #58137

Open cplepage opened 5 months ago

cplepage commented 5 months ago

🔎 Search Terms

memory leak

🕗 Version & Regression Information

⏯ Playground Link

No response

💻 Code

// Your code here

🙁 Actual behavior

In safari (Webkit/JavaScriptCore). Old Program never gets GCed because of reference on it.

Memory build up really quickly.

🙂 Expected behavior

Unreferenced and gc

Additional information about the issue

No response

cplepage commented 5 months ago

Safari web inspector, running TS language service to getDiagnostics on file update.

without fix:

Screenshot 2024-04-09 at 3 25 25 PM

with fix:

Screenshot 2024-04-09 at 3 27 02 PM
RyanCavanaugh commented 5 months ago

Accepting PRs to fix memory leaks, but we obviously can't really investigate something without a repro

cplepage commented 5 months ago

@RyanCavanaugh definitely, I will build a little something to make this issue reproducible and figure out what could go on. But I will need some time. Please allow me 1-2 week and I will come back here with a clear workable playground.