Skip to content

Commit e125539

Browse files
committed
Read version using subprocesses
solc-js or emscripten causes some kind of memory leak and node.js runs out of memory
1 parent 9c48f74 commit e125539

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"devDependencies": {
1010
"ethereumjs-util": "^5.0.1",
11-
"solc": "^0.4.24",
1211
"standard": "^8.4.0",
1312
"swarmhash": "^0.1.0"
1413
},

update

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('path')
77
const semver = require('semver')
88
const ethUtil = require('ethereumjs-util')
99
const swarmhash = require('swarmhash')
10-
const solc = require('solc/wrapper')
10+
const cp = require('child_process')
1111

1212
// This script updates the index files list.js and list.txt in the bin directory,
1313
// as well as the soljson-latest.js files.
@@ -33,7 +33,10 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
3333
}
3434

3535
function readBuiltinVersion (file) {
36-
return solc(require(path.join(__dirname, '/bin', file))).version()
36+
// NOTE: should be using this, but it leaks memory
37+
// return solc(require(path.join(__dirname, '/bin', file))).version()
38+
const filename = path.join(__dirname, '/bin', file)
39+
return cp.execSync(`/usr/bin/env node -e "console.log(require('${filename}').cwrap('version', 'string', [])())"`).toString().trim()
3740
}
3841

3942
// ascending list (oldest version first)

0 commit comments

Comments
 (0)