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

Memory Leak disposing oldProgram #58137

Open
cplepage opened this issue Apr 9, 2024 · 4 comments Β· May be fixed by #58138
Open

Memory Leak disposing oldProgram #58137

cplepage opened this issue Apr 9, 2024 · 4 comments Β· May be fixed by #58138
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone

Comments

@cplepage
Copy link

cplepage commented Apr 9, 2024

πŸ”Ž Search Terms

memory leak

πŸ•— Version & Regression Information

  • This is a crash

⏯ 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 cplepage linked a pull request Apr 9, 2024 that will close this issue
@cplepage
Copy link
Author

cplepage commented Apr 9, 2024

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 RyanCavanaugh added Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases labels Apr 11, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 11, 2024
@RyanCavanaugh
Copy link
Member

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

@cplepage
Copy link
Author

@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.

@cplepage
Copy link
Author

The easiest way to reproduce will be to run it as I encountered the issue.

Requirements

  • Git
  • Node >=18
  • MacOS (issue is only in Safari)

Setting up

  1. Clone the FullStacked Editor repo
  2. Checkout the typescript branch
  3. Pull all submodules
  4. Build TypeScript
  5. Install FullStacked Editor deps
  6. Start with the MUI sample repo
  7. Wait until the MUI sample project launches

Do all of this by copy/pasting the below snippet in Terminal.
Some of these steps will take quite a while.
Full process is up to 10 minutes.

git clone https://github.com/fullstackedorg/editor.git; cd editor
git checkout typescript
git submodule update --init --recursive --progress
cd lib/typescript; npm i; npm run build; cd ../..
npm i
npm start -- "https://github.com/fullstackedorg/editor-sample-mui.git?branch=ts"

*If at the end of the process you are not in Safari, close all popped up tabs and open http://localhost:9000 in Safari.

Testing the issue

In Safari, in FullStacked Editor, in the fullstackedorg/editor-sample-mui project,

  1. Open any .ts/.tsx file and wait for the TypeScript icon (top-right) to stop flashing.
  2. Open up the debug console, go in the Timelines tab and start recording.
  3. Edit the opened .ts/.tsx file constantly (hit enter at an interval of 1-2s) and monitor the memory. It should stay around 500-700mb

Now with your favorite code editor, open and comment out lib/TypeScript/src/services/services.ts#1802. Then, in Terminal, stop and rerun npm start and redo the three steps above. Check the memory climb nonstop (will go beyond 1GB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants