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

fix memory leak in ts client. #61

Merged
merged 2 commits into from
Jul 6, 2024
Merged

Conversation

Simon-Laux
Copy link
Member

Old Promises including their return values were not garbage collected, because they were not removed from the _requests Map.

fixes #60

Old Promises including their return values were not garbage collected, because they were not removed from the `_requests` Map.

fixes #60
@@ -40,6 +40,7 @@ export abstract class BaseTransport<T = {}>
if (!handler) return; // TODO: Handle error.
if (response.error) handler.reject(response.error);
else handler.resolve(response.result);
this._requests.delete(response.id)
Copy link
Contributor

@link2xt link2xt Jul 5, 2024

Choose a reason for hiding this comment

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

Should this be immediately after get(), so handler is removed from the map even if it fails with exception?
Or right after checking for !handler.

@link2xt link2xt merged commit e4cffd0 into main Jul 6, 2024
3 of 4 checks passed
@link2xt link2xt deleted the simon/fix-memory-leak-in-ts-client branch July 6, 2024 01:45
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.

typescript client: crashes after some amount of requests
2 participants