Search code examples
javascriptperformanceunit-testingout-of-memoryintern

Intern - Debugging out of memory exceptions


We're currently running into the following error when running Intern test runner for our JS test suite.

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

This error occurs before any test information is passing. I suspect that some of our tests are leaking memory or doing some expensive operations. How can I debug this?


Solution

  • That is a Node error rather than an Intern error. It indicates that the Node runtime has run out of memory.

    A brute force fix would be to just allocate more memory to Node. You could try running node with the --max_old_space_size option, which affects the maximum amount of memory node can have allocated. The value is in megabytes; by default it's 512. Try something like node --max_old_space_size=2048.

    A better fix would be to try to narrow down which suite (assuming it's a test suite) is allocating so much memory, and to modify the test or suite to mitigate the problem.