Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase max old space size not working #14590

Closed
khomyakov42 opened this issue Aug 2, 2017 · 5 comments
Closed

increase max old space size not working #14590

khomyakov42 opened this issue Aug 2, 2017 · 5 comments
Labels

Comments

@khomyakov42
Copy link

@khomyakov42 khomyakov42 commented Aug 2, 2017

  • v8.2.1:
  • Linux khomyakov-wpc 4.10.0-29-generic #33-Ubuntu SMP Wed Jul 19 13:34:25 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux:

I run this code:

const MAX = Math.pow(10, 8);
const objects = new Map();
for (let i = 0; i < MAX; ++i) {
   objects.set(i, i);
}

Result:

/usr/bin/node /home/khomyakov42/Projects/one-world/exp.js
FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/bin/node]
 2: 0x55ce7d8626ae [/usr/bin/node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/bin/node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/bin/node]
 5: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [/usr/bin/node]
 6: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Rehash(v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/usr/bin/node]
 7: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::EnsureGrowable(v8::internal::Handle<v8::internal::OrderedHashMap>) [/usr/bin/node]
 8: 
v8::internal::Runtime_MapGrow(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
 9: 0x3bc002a840bd
<--- Last few GCs --->

[17415:0x55ce7f7f55b0]     9406 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
[17415:0x55ce7f7f55b0]     9445 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
[17415:0x55ce7f7f55b0]     9484 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
[17415:0x55ce7f7f55b0]     9524 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x27d2e961bbd9 <JS Object>
    1: set [native collection.js:1] [pc=0x3bc002bb8303](this=0x1bffb26fe789 <a Map with map 0x35e705394319>,p=16777216,x=16777216)
    2: main [/home/khomyakov42/Projects/one-world/exp.js:~4] [pc=0x3bc002c59614](this=0x37dce82861b9 <JS Global Object>)
    3: /* anonymous */ [/home/khomyakov42/Projects/one-world/exp.js:27] [pc=0x3bc002bea505](this=0x1bffb26c4749 <an Object with map 0x35e70538493...


Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I used the flag to increase the maximum memory --max-old-space-size=2000 but it had no effect

/usr/bin/node --max-old-space-size=2000 /home/khomyakov42/Projects/one-world/exp.js
FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory

 1: node::Abort() [/usr/bin/node]
<--- Last few GCs --->

 2: 0x55596527f6ae [/usr/bin/node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/bin/node]
[17853:0x555966aae5d0]     9503 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
 4: [17853:0x555966aae5d0]     9543 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
[17853:0x555966aae5d0]     9582 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 
[17853:0x555966aae5d0]     9620 ms: Scavenge 682.3 (689.0) -> 678.4 (689.0) MB, 0.1 / 0.0 ms  allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3c468d31bbd9 <JS Object>
    1: set [native collection.js:1] [pc=0x28d8bb338303](this=0x1760d42fe789 <a Map with map 0x1f816e014319>,p=16777216,x=16777216)
    2: main [/home/khomyakov42/Projects/one-world/exp.js:~4] [pc=0x28d8bb3d8594](this=0x109412f861b9 <JS Global Object>)
    3: /* anonymous */ [/home/khomyakov42/Projects/one-world/exp.js:27] [pc=0x28d8bb36a505](this=0x1760d42c4749 <an Object with map 0x1f816e00493...

v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/bin/node]
 5: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [/usr/bin/node]
 6: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Rehash(v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/usr/bin/node]
 7: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::EnsureGrowable(v8::internal::Handle<v8::internal::OrderedHashMap>) [/usr/bin/node]
 8: v8::internal::Runtime_MapGrow(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
 9: 0x28d8bb2040bd

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

But if add console.log to body:

const MAX = Math.pow(10, 8);
const objects = new Map();
for (let i = 0; i < MAX; ++i) {
   objects.set(i, i);
   console.log(i);
}

then flag --max-old-space-size working:

8388607

<--- Last few GCs --->

[18029:0x561164d645d0]    95419 ms: Mark-sweep 1637.6 (1955.0) -> 1637.6 (1955.5) MB, 3425.7 / 0.0 ms  allocation failure GC in old space requested
[18029:0x561164d645d0]    98896 ms: Mark-sweep 1637.6 (1955.5) -> 1637.5 (1915.0) MB, 3477.3 / 0.0 ms  last resort 
[18029:0x561164d645d0]   102424 ms: Mark-sweep 1637.5 (1915.0) -> 1637.5 (1905.5) MB, 3528.0 / 0.0 ms  last resort 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x10da9441bbd9 <JS Object>
    1: set [native collection.js:1] [pc=0x264266b38303](this=0x1ef5db712571 <a Map with map 0x19b2d8a94319>,p=8388608,x=8388608)
    2: main [/home/khomyakov42/Projects/one-world/exp.js:~4] [pc=0x264266b3c83f](this=0x2dd5bc90a1e1 <JS Global Object>)
    3: /* anonymous */ [/home/khomyakov42/Projects/one-world/exp.js:28] [pc=0x264266b6a505](this=0x16895ed48929 <an Object with map 0x19b2d8a84931>...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/bin/node]
 2: 0x5611623ac6ae [/usr/bin/node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/bin/node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/bin/node]
 5: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [/usr/bin/node]
 6: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [/usr/bin/node]
 7: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::Rehash(v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/usr/bin/node]
 8: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, v8::internal::JSMapIterator, 2>::EnsureGrowable(v8::internal::Handle<v8::internal::OrderedHashMap>) [/usr/bin/node]
 9: v8::internal::Runtime_MapGrow(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
10: 0x264266a040bd

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
@khomyakov42 khomyakov42 changed the title increase max old space size more 4GB increase max old space size not working Aug 2, 2017
@mscdex
Copy link
Contributor

@mscdex mscdex commented Aug 2, 2017

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Aug 2, 2017

All three runs fail with an error, don't they? Is the bug report here that the second one fails with "invalid table size" instead of "out of memory"? That's because collections have a maximum size (512 MB on 32 bits architectures, 1 GB on 64 bits, IIRC.)

@mscdex
Copy link
Contributor

@mscdex mscdex commented Aug 2, 2017

Seems like it should throw a JS exception on invalid size instead of a hard crash though.

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Aug 2, 2017

You'd have to take that up with the V8 team. It's not just maps and sets though; arrays have similar size limits.

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Aug 8, 2017

I'll close this out. If anyone feels the current behavior isn't what it should be, please file an issue or CL with V8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.