nodeJs huge array processing throws RangeError: Maximum call stack size exceeded

后端 未结 2 1839
清歌不尽
清歌不尽 2021-01-31 22:27

This is part of code to proceed big number of entries ( originally its works with file system and make some operations with files) . Is there any nice way to bypass the limitat

2条回答
  •  梦谈多话
    2021-01-31 23:01

    An option could be passing --max-stack-size to node.

    node --max-stack-size 32000 app.js
    

    For reference, use node -h

    --max-stack-size=val set max v8 stack size (bytes)

    Update

    Even though help prints it as --max-stack-size, in node -v v0.10.x+ you need to use --stack-size instead.

    node --stack-size=32000 app.js
    

提交回复
热议问题