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

[Bug]: Memory leak when importing multiple @aws-sdk libraries #15390

Open
stefanonardo opened this issue Nov 26, 2024 · 1 comment
Open

[Bug]: Memory leak when importing multiple @aws-sdk libraries #15390

stefanonardo opened this issue Nov 26, 2024 · 1 comment

Comments

@stefanonardo
Copy link

Version

29.7.0

Steps to reproduce

  1. Clone my repo at https://github.com/stefanonardo/jest-leak-test
  2. npm install
  3. npm test -- --detectLeaks
  4. It should detect leaks

Expected behavior

It should not detect any leak

Actual behavior

If you take a heap snapshot at the end of the test you'll see that the garbage collector is not removing the the imported modules at the end of a test suite.

Additional context

A heap snapshot at the end of the tests does indeed show duplicate imports. The repository I provided is a minimal example: if you remove one of the imports, Jest no longer detects any memory leaks.

This issue occurred to me with the aws-sdk libraries, but it might not be strictly related to them. I could not pinpoint what specific characteristic of the aws-sdk libraries causes this.

Environment

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.11.0/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
@stefanonardo stefanonardo changed the title [Bug]: Memory leak when importing @aws-sdk [Bug]: Memory leak when importing multiple @aws-sdk libraries Nov 26, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant