Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs memory allocation failure

I was using decryption to decrypt "MySql" data. I got the below issue:

<--- Last few GCs --->
31681 ms: Mark-sweep 654.1 (666.5) -> 492.5 (509.8) MB, 267.5 / 0.0 ms [allocation failure] [GC in old space requested].
31839 ms: Mark-sweep 492.5 (509.8) -> 492.2 (506.8) MB, 157.5 / 0.0 ms [allocation failure] [GC in old space requested].
31985 ms: Mark-sweep 492.2 (506.8) -> 492.2 (497.8) MB, 146.2 / 0.0 ms [last resort gc]. 32122 ms: Mark-sweep 492.2 (497.8) -> 492.2 (497.8) MB, 136.8 / 0.0 ms [last resort gc]. <--- JS stacktrace --->

What is it regarding and how to fix it,

Thanks in advance

like image 792
Pvvd Prasad Avatar asked Oct 11 '17 13:10

Pvvd Prasad


1 Answers

Alllocate more memory to your script by using the following argument to node: --max_old_space_size=x

Example:

node --max_old_space_size=8000 yourscript.js

This will allocate about 8GB to your script. Eventually this is still not sufficient and you should decrypt your SQL in smaller chunks and make use of your physical drive instead of RAM memory.

Hope this helps!

like image 111
Cryptic Pug Avatar answered Sep 18 '22 21:09

Cryptic Pug