Closed shark0der closed 1 year ago
same issue
Here's a simple contract that reproes this on a brand new hardhat project https://gist.github.com/msfeldstein/4519c50b5e6b3be902d55868a6a73bda
Hey, @msfeldstein, can you try again with the latest version of hardhat? We changed a few things that should fix this.
Closing in favor of https://github.com/NomicFoundation/hardhat/issues/3458.
Description
I am using multiple compiler versions and I started to get OOM errors. The compilation itself works but the OOM error happens after recompiling a single contract and running the tests. After force recompiling - everything works again. The error is tricky to reproduce and I don't yet have a certain way to do it.
Hinted by @alcuadrado I tried passing the
--max-memory
argument which seems to set the--max-old-space-size
node option but it doesn't work! I've tried usingnpx hardhat --max-memory 8192 test
andnode_modules/.bin/hardhat --max-memory 8192 test
, in both cases it crashes. I was able to get it working by setting the environment variableNODE_OPTIONS="--max-old-space-size=4096"
.The crash itself seems to happen while running the tests. I've put a few console.logs (the stack traces are useless). It reaches the
console.log
that's outside thedescribe
(top-level), reaches the callback passed todescribe
but fails to reach thebeforeEach
andit
callbacks.The contract that I'm editing has
pragma solidity ^0.5.0;
and is compiled with0.5.17
. I have not encountered this before hardhat 2.0.7 (but this could totally be a coincidence!).System info
Hardhat config
Error
To summarize, there are 2 issues:
--max-memory
flag does not work