-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snarkjs fail beacuse eached heap limit Allocation failed - JavaScript heap out of memory #397
Comments
I have a similar problem. I'm running snarkjs on a linux x64 machine with 256GB RAM and I have a circuit composed by ~28M constraints. Output
Circuithttps://github.com/leonardovona/beacon-relay/blob/main/circuits/circuits/step.circom Steps to reproduce
|
This helped me get around the memory issues: sysctl -w vm.max_map_count=655300 Note to anyone who got here because they have the same memory issuevalid for Unix systems, not sure about Windows 1. Increase V8 memoryYou can increase V8 max memory size with # by exporting an environment variable..
export NODE_OPTIONS="--max-old-space-size=<size>"
# run your node/npx/snarkjs command..
# using a command-scoped environment variable..
NODE_OPTIONS="--max-old-space-size=<size>" # your npx/snarkjs command
# via the node cli option..
node --max-old-space-size=<size> # rest of command The value does not need to be less than your system memory (although the Nodejs docs do recommend this). 2. Increase kernel memory map per processThe value can be set like so sysctl -w vm.max_map_count=<size> The default value is 65530 and a 10x increase seemed to work for me. |
Here is a bunch of good reading for if you have a large circuit: https://hackmd.io/V-7Aal05Tiy-ozmzTGBYPA?view |
When I generate a circom, JavaScript heap out of memory happens, how to fix this problem?
The text was updated successfully, but these errors were encountered: