We are using Chromium Embedded Framework (CEF) for our native application. For some cases we may need heap memory in V8 JS layer. So I tried following to see how far I can create objects.
(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));
})();
My assumption was that this script should be able to create object until we reach 10 GB limit. But It fails in V8 while committing memory in VirtualAlloc (in file platform-win32.cc). GetLastError returns "ERROR_COMMITMENT_LIMIT 1455 (0x5AF) The paging file is too small for this operation to complete."
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?