Skip to content

Instantly share code, notes, and snippets.

@a0viedo
Created February 9, 2017 19:21
Show Gist options
  • Save a0viedo/44a7fba0a282855584ab2d2f5f1ff6c4 to your computer and use it in GitHub Desktop.
Save a0viedo/44a7fba0a282855584ab2d2f5f1ff6c4 to your computer and use it in GitHub Desktop.
var arr = [];
while(arr.length < 48000000) {
arr.push(Math.random());
}
$ node heap-test.js
<--- Last few GCs --->
10 ms: Scavenge 2.1 (7.0) -> 2.1 (8.0) MB, 0.8 / 0.0 ms [allocation failure].
68 ms: Scavenge 3.9 (11.0) -> 3.6 (13.0) MB, 0.6 / 0.0 ms [allocation failure].
72 ms: Scavenge 4.8 (13.0) -> 3.9 (13.0) MB, 0.7 / 0.0 ms [allocation failure].
1166 ms: Mark-sweep 1072.4 (1081.2) -> 861.6 (871.4) MB, 0.5 / 0.0 ms (+ 2.2 ms in 2 steps since start of marking, biggest step 2.2 ms) [GC interrupt] [GC in old space requested].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x1974a4bcfb51 <JS Object>
2: /* anonymous */ [/home/fsociety/Documents/dev/benchmark-all-your-nodes/heap-test.js:~1] [pc=0xa5826f4c1f9] (this=0x3129af68fc1 <an Object with map 0x2f3ce02075e9>,exports=0x3129af68fc1 <an Object with map 0x2f3ce02075e9>,require=0x3129af69151 <JS Function require (SharedFunctionInfo 0x3129af5e7f9)>,module=0x3129af690c9 <a Module with map 0x145f9291bb71>,__filename=0x3129af69069 <String[6...
FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x1098b2c [node]
3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Heap::AllocateUninitializedFixedDoubleArray(int, v8::internal::PretenureFlag) [node]
6: v8::internal::Factory::NewFixedDoubleArray(int, v8::internal::PretenureFlag) [node]
7: 0xc4c130 [node]
8: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [node]
9: 0xa5826e079a7
Aborted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment