Skip to content

Memory leak issue with jest #1817

Closed
@juhosuominen

Description

What is the expected behavior?
Node heap size shouldn't grow in every test.

What is the actual behavior?
Heap size increases after every test file.

With nock:

PASS  test/function-86.js (22 MB heap size)
PASS  test/function-75.js (22 MB heap size)
PASS  test/function-1.js (22 MB heap size)
PASS  test/function-43.js (26 MB heap size)
PASS  test/function-24.js (26 MB heap size)
...
PASS  test/function-48.js (133 MB heap size)
PASS  test/function-82.js (137 MB heap size)
PASS  test/function-87.js (137 MB heap size)
PASS  test/function-20.js (137 MB heap size)
PASS  test/function-79.js (140 MB heap size)

Test Suites: 100 passed, 100 total
Tests:       100 passed, 100 total
Snapshots:   0 total
Time:        25.506s, estimated 26s

Without nock:

PASS  test/function-86.js (19 MB heap size)
PASS  test/function-75.js (19 MB heap size)
PASS  test/function-1.js (19 MB heap size)
PASS  test/function-65.js (19 MB heap size)
PASS  test/function-96.js (19 MB heap size)
...
PASS  test/function-93.js (20 MB heap size)
PASS  test/function-61.js (20 MB heap size)
PASS  test/function-49.js (20 MB heap size)
PASS  test/function-87.js (20 MB heap size)
PASS  test/function-79.js (20 MB heap size)

Test Suites: 100 passed, 100 total
Tests:       100 passed, 100 total
Snapshots:   0 total
Time:        27.079s

How to reproduce the issue

Even a single require/import of nock seems to cause the issue.

Minimal test case: https://github.com/juhosuominen/jest-nock-memory-leak

Versions

Software Version(s)
Nock 11.7.0
Node 11.15.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions