DEV Community

Kiet Nguyen
Kiet Nguyen

Posted on

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)