jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 510 forks source link

"process out of memory" with "disallowUnusedParams" and "requireSpaceAfterComma" #2257

Closed dmartinezg closed 8 years ago

dmartinezg commented 8 years ago

Hi, the following code on jscs v3.0.3, on Mac:

let _ = require('lodash');

(() => {
 console.log(_.filter([1,2,3], _.isNum))
}) ();

With this .jscsrc file

{
  "disallowUnusedParams":   true,
  "requireSpaceAfterComma": true
}

Runs out of memory:

random-thoughts:repository-service damian$ ./node_modules/jscs/bin/jscs pepe.js

<--- Last few GCs --->

   10011 ms: Scavenge 1289.5 (1329.2) -> 1289.5 (1329.2) MB, 2.4 / 0 ms (+ 1.0 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
   10395 ms: Mark-sweep 1289.5 (1329.2) -> 932.1 (971.7) MB, 383.6 / 0 ms (+ 95.3 ms in 1938 steps since start of marking, biggest step 1.0 ms) [last resort gc].
   10701 ms: Mark-sweep 932.1 (971.7) -> 932.0 (971.7) MB, 306.8 / 0 ms [last resort gc].

<--- JS stacktrace --->

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

Security context: 0x2d985f1b4629 <JS Object>
    2: _buildIndex [/Users/damian/projects/repository-service/node_modules/jscs/lib/token-index.js:~46] [pc=0x165c96b24a73] (this=0xed9a4fd3a51 <a TokenIndex with map 0x34d32d952651>,firstToken=0xed9a4fd3af9 <a Token with map 0x34d32d952701>)
    3: new constructor(aka TokenIndex) [/Users/damian/projects/repository-service/node_modules/jscs/lib/token-index.js:37] [pc=0x165c96b6c18b] (this=0xed9...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6

If I remove any rule, it works, and if I fix the code error (the missing spaces after the commas) it also works

markelog commented 8 years ago

See https://github.com/cst/cst/issues/113