question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Javascript heap out of memory

See original GitHub issue

After a while of fairly heavy use (like we use a Parity node in production) Ganache stops working due to an out of memory error. (docker image: trufflesuite/ganache-cli:v6.1.8)

ethereum_1                | 
ethereum_1                | <--- Last few GCs --->
ethereum_1                | 
ethereum_1                | [1:0x561ab041e000] 26545867 ms: Mark-sweep 1404.1 (1464.4) -> 1404.0 (1464.4) MB, 378.3 / 0.0 ms  allocation failure GC in old space requested
ethereum_1                | [1:0x561ab041e000] 26546370 ms: Mark-sweep 1404.0 (1464.4) -> 1404.0 (1433.4) MB, 502.1 / 0.1 ms  last resort GC in old space requested
ethereum_1                | [1:0x561ab041e000] 26546865 ms: Mark-sweep 1404.0 (1433.4) -> 1404.0 (1433.4) MB, 495.8 / 0.1 ms  last resort GC in old space requested
ethereum_1                | 
ethereum_1                | 
ethereum_1                | <--- JS stacktrace --->
ethereum_1                | 
ethereum_1                | ==== JS stack trace =========================================
ethereum_1                | 
ethereum_1                | Security context: 0x56ffe825879 <JSObject>
ethereum_1                |     1: set(this=0x912f019afe1 <Map map = 0x3997f91848d9>,0x13318c210739 <JSArray[152]>,0xc4b8d949dd9 <JSArray[152]>)
ethereum_1                |     2: set [/src/build/cli.node.js:~10] [pc=0x1d0b12cec68b](this=0x912f019aeb1 <yc map = 0x236896533a01>,e=0x13318c210739 <JSArray[152]>,a=0xc4b8d949dd9 <JSArray[152]>)
ethereum_1                |     3: Ic [/src/build/cli.node.js:~10] [pc=0x1d0b12faf924](this=0x382ee240c209 <JSGlobal Object>,e=0x13318c210739...
ethereum_1                | 
ethereum_1                | FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

To give an idea what I mean by fairly heavy usage, the full log: https://gist.github.com/roderik/82cba1882eb67b7e64c6482d12dd25d5 (about 19k lines)

Startup command:

  ethereum:
    image: trufflesuite/ganache-cli:v6.1.8
    ports:
      - '8545:8545'
    command:
      [
        'node',
        './build/cli.node.js',
        '--secure',
        '--gasPrice',
        '0',
        '--unlock',
        '0',
        '--gasLimit',
        '0xfffffffffff',
        '--host',
        '0.0.0.0',
        '--networkId',
        '1337',
        '--mnemonic',
        'robot robot robot robot robot robot robot robot robot robot robot robot',
      ]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
fubhycommented, Oct 16, 2020

I can also verify that there is definitely a memory leak in ganache. I’ve also observed it while tracking the it with node --inspect in and profiling the memory allocation in chrome devtools (capturing >1 day of data). Memory usage steadily increases including some inexplicable spikes in between. I haven’t yet found the culprit though.

0reactions
m1cm1ccommented, Oct 22, 2021

@kevinweaver Both the transaction and the gas estimation work with Ganache v7.0.0-alpha.1. Thank you for the hint about upgrading. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
A common problem while working on a JavaScript Node.js project is the “JavaScript heap out of memory” error. This error usually occurs when ......
Read more >
Node.js heap out of memory - javascript - Stack Overflow
I have a 64-bit CPU and I've installed x86 node version, which caused the CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ......
Read more >
JavaScript heap out of memory - Snyk Support
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >
How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. ... Alternatively, you ......
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
A quick solution that you can use to fix "Heap Out Of Memory Error" in JavaScript. We lay out the causes and how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found