DEV Community

Kiet Nguyen
Kiet Nguyen

Posted on

3 2

Get max memory size of V8

The default max memory size of V8 is 2GB:

$ node

> v8.getHeapStatistics()
{
  ....
  heap_size_limit: 2197815296,
  ...
}
Enter fullscreen mode Exit fullscreen mode

2197815296 is 2GB in bytes. When set NODE_OPTIONS=--max_old_space_size=8192, heap_size_limit will be 8G or 8640266240 bytes.

$ NODE_OPTIONS=--max_old_space_size=8192 node

> v8.getHeapStatistics()
{
  ....
  heap_size_limit: 8640266240,
  ...
}
Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay