postcss: Postcss out of memory when it is parsing many files

Basically postcss parse and keep in memory every file passed by grunt blob and it parse until breaking and goes out of memory.

example:

grunt.initConfig({
  postcss: {
    options: {
      processors: [
        require('autoprefixer')({browsers: 'last 2 versions'})
      ]
    },
    dist: {
      src: 'css/*.css' // 50 css file with 20.000 line of css
    }
  }
});

error message I see in console:

<--- Last few GCs --->

   69906 ms: Scavenge 1397.3 (1458.2) -> 1397.3 (1458.2) MB, 0.9 / 0 ms (+ 1.0 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
   70766 ms: Mark-sweep 1397.3 (1458.2) -> 1390.5 (1458.2) MB, 860.2 / 0 ms (+ 1.0 ms in 1 steps since start of marking, biggest step 1.0 ms) [last resort gc].
   71601 ms: Mark-sweep 1390.5 (1458.2) -> 1392.3 (1458.2) MB, 834.5 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 00000348E1AB4639 <JS Object>
    1: spacesFromStart [C:\projects\matteo-project\node_modules\postcss\lib\parser.js:~401] [pc=000001F0D87ADC63] (this=0000020F9DD924E9 <a ScssParser with map 00000322811F6AF9>,tokens=00000247023BD939 <JS Array[9]>)
    2: decl [C:\projects\matteo-project\node_modules\postcss\lib\parser.js:235] [pc=000001F0D8906DCC] (this=0000020F9DD924E9 <a ScssParser with map 00000322811F6AF9>,tokens=000002470...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

@VitaliyR could you please create a issue in source-map with full stacktrace and your project description. Also maybe you should give them one file with source map to investigation.

If problem came from this library they will know more how to fix it.