Skip to content

Commit 92ddf41

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 f005986 commit 92ddf41

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"semver": "^5.3.0"
88
},
99
"devDependencies": {
10+
"child_process": "^1.0.2",
1011
"ethereumjs-util": "^5.0.1",
11-
"solc": "^0.4.24",
1212
"standard": "^8.4.0",
1313
"swarmhash": "^0.1.0"
1414
},

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)