How to increase JS Heap size limit?

1,405 views
Skip to first unread message

tuma...@gmail.com

unread,
Mar 11, 2016, 11:14:04 AM3/11/16
to v8-dev
Hi,

We need to increase the V8 heap size limit for certain case. Can some one please point me the source code where we can change this limit? 

Regards,
T. Umapathy


Jochen Eisinger

unread,
Mar 11, 2016, 11:17:29 AM3/11/16
to v8-dev

Is configuring the size via the ResourceConstraint class not covering your use case?


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tuma...@gmail.com

unread,
Mar 14, 2016, 11:24:43 AM3/14/16
to v8-dev
I tried with --js-flags="--max-old-space-size=10000" while launching my app (using CEF). 

And used below script to check (from https://bugs.chromium.org/p/v8/issues/detail?id=847)
(function () {
  function tree (n, m) {
    if (n > 0) {
      var a = new Array(m);
      for (var i = 0; i < m; i++) a[i] = tree(n - 1, m);
      return a;
    }
  } 

  var trees = [];
  while (true) trees.push(tree(15, 2));
})();

After some time, the allocation in below line (in src\heap\spaces.cc PagedSpace::Expand()) fails and render process is crashing (memory usage was around 3GB +).
------------------------------------------------------------------------------------------------------------------------------------------------

Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this,
                                                                executable());
  if (p == NULL) return false;

tuma...@gmail.com

unread,
Mar 15, 2016, 12:49:36 AM3/15/16
to v8-dev, tuma...@gmail.com
Exactly It fails in committing memory in VirtualAlloc (in file platform-win32.cc). 

bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
  int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
  if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) {
    return false;
  }
  return true;
}

Anybody knows whats going wrong here?

Jochen Eisinger

unread,
Mar 15, 2016, 4:25:33 AM3/15/16
to v8-dev, tuma...@gmail.com
it means that the process ran out of memory. ~3GB sounds like you're running a 32bit build?

tuma...@gmail.com

unread,
Mar 15, 2016, 5:40:29 AM3/15/16
to v8-dev, tuma...@gmail.com
I am using 64 bit build. This issue is reproducible in Windows machine. I tried in MAC 64 bit build, it runs fine until it reaches the limit easily.

Steps to reproduce it in chrome browser (64bit):

1. launch from command line with args --js-flags="--max-old-space-size=10000"
2. use chrome developer tools to run the below script from console.
(function () {
  function tree (n, m) {
    if (n > 0) {
      var a = new Array(m);
      for (var i = 0; i < m; i++) a[i] = tree(n - 1, m);
      return a;
    }
  } 

  var trees = [];
  while (true) trees.push(tree(15, 2));
})();

tuma...@gmail.com

unread,
Mar 15, 2016, 12:06:50 PM3/15/16
to v8-dev, tuma...@gmail.com
VirtualAlloc fails with following error "ERROR_COMMITMENT_LIMIT 1455 (0x5AFThe paging file is too small for this operation to complete."

Any Idea how this limit can be increased?
Reply all
Reply to author
Forward
0 new messages