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 leakage occurs in the getTypeAtLocation method in the latest version. #61008

Open
1 task done
majie77 opened this issue Jan 22, 2025 · 3 comments
Open
1 task done
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@majie77
Copy link

majie77 commented Jan 22, 2025

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Invoke the getTypeAtLocation method one million times cyclically. Before and after the loop, perform GC and print heapUsed. The memory usage increases by about 150 MB.

@jakebailey
Copy link
Member

You haven't provided much information.

Are you calling it on the same location each time, or a different one?

How much memory is being used before/after?

If you're saying it happens in the "latest" version, are you saying that it didn't used to happen?

If it didn't happen before, have you tried to bisect with https://www.npmjs.com/package/every-ts?

@majie77
Copy link
Author

majie77 commented Jan 23, 2025

My demo code is as follows:

global.gc();
const m = process.memoryUsage();
console.log(m.heapUsed);
for (let a=1;a <= 1000000;a++) {
typeChecker.getTypeAtLocation(node.typeName);
}
global.gc();
const m1 = process.memoryUsage();
console.log(m1.heapUsed);

Test results of different versions:

Image

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Jan 30, 2025
@RyanCavanaugh
Copy link
Member

Please post a sample we can run ourselves; this could depend on any number of factors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

3 participants