Quantcast
Viewing all articles
Browse latest Browse all 8697

GCP Cloud Build で `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`

ヒープ領域が限界に近くて割り当てに失敗したらしい

Cloud Build で使われていたマシン

解決策

  • NODE_OPTIONS=--max-old-space-size=xxx
    • xxxにメガバイト単位の数字を指定。 筆者は3072と指定した
  • --max-old-space-size=xxx
    • https://nodejs.org/docs/latest-v12.x/api/cli.html#cli_node_options_options
    • ヒープの Old 領域をメガバイト単位で指定してあげる
    • 注意として,ここで指定するのは Old 領域なのでメNode.jsに割り当てられるメモリサイズ==指定サイズ とはならない
      • 指定サイズに New 領域を加算した値が実際に Node.js に割り当てられるメモリサイズになる

参考
- http://www.the-data-wrangler.com/nodejs-memory-limits/


Viewing all articles
Browse latest Browse all 8697

Trending Articles