Skip to content

Commit 093ce57

Browse files
cgeweckesam
authored and
sam
committed
Mention reducing instrumentation footprint in "Running out of memory" section
1 parent 2b699f4 commit 093ce57

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

docs/faq.md

+39-3
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,49 @@ We use [Codecov.io][2] here as a coverage provider for our JS tests - they're gr
6666

6767
## Running out of memory
6868

69-
If your target contains dozens of large contracts, you may run up against node's memory cap during the
69+
If your target contains dozens (and dozens) of large contracts, you may run up against Node's memory cap during the
7070
contract compilation step. This can be addressed by setting the size of the memory space allocated to the command
71-
when you run it. (NB: you must use the relative path to the truffle `bin` in node_modules)
71+
when you run it.
7272
```
73-
$ node --max-old-space-size=4096 ../node_modules/.bin/truffle run coverage [options]
73+
// Truffle
74+
$ node --max-old-space-size=4096 ./node_modules/.bin/truffle run coverage [options]
75+
76+
// Buidler
77+
$ node --max-old-space-size=4096 ./node_modules/.bin/buidler coverage [options]
78+
```
79+
80+
`solcjs` also has some limits on the size of the code bundle it can process. If you see errors like:
81+
82+
```
83+
// solc >= 0.6.x
84+
RuntimeError: memory access out of bounds
85+
at wasm-function[833]:1152
86+
at wasm-function[147]:18
87+
at wasm-function[21880]:5
88+
89+
// solc 0.5.x
90+
Downloading compiler version 0.5.16
91+
* Line 1, Column 1
92+
Syntax error: value, object or array expected.
93+
* Line 1, Column 2
94+
Extra non-whitespace after JSON value.
7495
```
7596
97+
...try setting the `measureStatementCoverage` option to `false` in `.solcoverjs`. This will reduce the footprint of
98+
the instrumentation solidity-coverage adds to your files. You'll still get line, branch and function coverage but the data Istanbul collects
99+
for statements will be omitted.
100+
101+
A statement differs from a line as below:
102+
```solidity
103+
// Two statements, two lines
104+
uint x = 5;
105+
uint y = 7;
106+
107+
// Two statements, one line
108+
uint x = 5; uint y = 7;
109+
```
110+
111+
76112
## Running out of time
77113

78114
Truffle sets a default mocha timeout of 5 minutes. Because tests run slower under coverage, it's possible to hit this limit with a test that iterates hundreds of times before producing a result. Timeouts can be disabled by configuring the mocha option in `.solcover.js` as below: (ProTip courtesy of [@cag](https://github.com/cag))

0 commit comments

Comments
 (0)