Closed weijiekoh closed 5 years ago
I tried again with this code:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const compile = require("circom");
compile("circuits/circuit.circom").then((cir) => {
console.log(cir);
}).catch((err) => {
console.error(err);
});
<--- Last few GCs --->
[8384:0x38dad20] 202887 ms: Mark-sweep 2076.6 (2269.4) -> 1250.9 (1950.4) MB, 580.1 / 0.0 ms allocation failure GC in old space requested
[8384:0x38dad20] 203568 ms: Mark-sweep 1250.9 (1950.4) -> 1250.5 (1661.4) MB, 680.6 / 0.0 ms last resort GC in old space requested
[8384:0x38dad20] 204234 ms: Mark-sweep 1250.5 (1661.4) -> 1250.5 (1583.9) MB, 665.4 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0xa0c1aea5879 <JSObject>
0: builtin exit frame: getOwnPropertySymbols(this=0xa0c1ae847f1 <JSFunction Object (sfi = 0x26f866d89cf9)>,0x3d601cfb9b1 <Object map = 0x36fc78902361>)
1: formatValue(aka formatValue) [util.js:414] [bytecode=0x184f00c5fb49 offset=435](this=0x26f866d822d1 <undefined>,ctx=0x31af8b31e681 <Object map = 0x26ab96e6f499>,valu
e=0x3d601cfb9b1 <Object map = 0x36fc78902361>,recurseTimes=1,ln=0x26f8...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x8c21ec [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [node]
6: v8::internal::BaseNameDictionary<v8::internal::NameDictionary, v8::internal::NameDictionaryShape>::CollectKeysTo(v8::internal::Handle<v8::internal::NameDictionary>, v8:
:internal::KeyAccumulator*) [node]
7: v8::internal::KeyAccumulator::CollectOwnPropertyNames(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::JSObject>) [node]
8: v8::internal::KeyAccumulator::CollectOwnKeys(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::JSObject>) [node]
9: v8::internal::KeyAccumulator::CollectKeys(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::JSReceiver>) [node]
10: v8::internal::KeyAccumulator::GetKeys(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::KeyCollectionMode, v8::internal::PropertyFilter, v8::internal::GetKe
ysConversion, bool) [node]
11: v8::internal::Builtin_ObjectGetOwnPropertySymbols(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0x1465bca8697d
Aborted (core dumped)
Resolved by running the above JS code as such:
nodejs --max_old_space_size=4000 build/index.js
I found the solution by realising that the npm test
command specifies --max_old_space_size
, which is also a nodejs flag.
To fix this, perhaps cli.js
could specify the --max_old_space_size
flag in the shebang.
Yes. I need to profile where the memory is spent.
In any case, I just extended the memory in cli.js. And now it works without problems.
Thank you!!
Using circom version 0.0.15:
After several minutes:
However, it works fine with
sum_test.circom
andconstants_test.circom
.