ramda: Heap out of memory

Executing this code in Node.js or Ramda REPL causes the process to crash.

const R = require('ramda')
let args = [x => x + 2, [ 1, 2, 3 ] ]
let expected = [3, 4, 5]

let results = []

for (let fnName of Object.keys(R)) {
  try {
    let tres = R[fnName](...args)
    if (R.equals(tres, expected)) {
      results.push(fnName)
    }
  } catch (e) {

  }
}

console.log(results)

Node.js stack trace:


<--- Last few GCs --->

[8348:0000022740F2BB60]     5422 ms: Mark-sweep 579.3 (591.2) -> 579.3 (591.2) MB, 248.0 / 0.0 ms  allocation failure GC in old space requested
[8348:0000022740F2BB60]     5674 ms: Mark-sweep 579.3 (591.2) -> 579.3 (584.2) MB, 252.6 / 0.0 ms  last resort GC in old space requested
[8348:0000022740F2BB60]     5945 ms: Mark-sweep 579.3 (584.2) -> 579.3 (584.2) MB, 270.4 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0000028374A778A1 <JSObject>
    1: unfold [path_to_project\node_modules\ramda\src\unfold.js:~30] [pc=00000316DBE0BD9D](this=000001989810BE21 <JSGlobal Object>,fn=00000185CFEA75F1 <JSFunction x (sfi = 000001F3522C7EF9)>,seed=00000185CFEA75D1 <JSArray[3]>)
    3: f2 [path_to_project\node_modules\ramda\src\internal\_curry2.js:29] [bytecode=0000028374A2CAE9 offset=201](this=0...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Is there something inherently wrong in the code I wrote that causes the crash?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (14 by maintainers)

Most upvoted comments

Yep! I had to look that one up. Didn’t even remember the function! 😄