title: Mongoose Insert Many Heap Out of Memory
body: <p>I am trying to run a mongoose insert many command with an array that contains about 145,000 JSON objects. I ran this command locally on my mac test environment and it doesn't crash however, when i run it on my dev Windows environment it does. </p>
  
  <p>I have tried to run the "node max-old-space=6086 app.js" command and it works great on my mac (no crash) but crashes on my Windows 2016 machines with the SAME array of objects. Is this a Windows problem? </p>
  
  <p>Also i replaced the sensitive values below with the word "something" to not reveal what my application is doing. </p>
  
  <pre><code>const folder = "./monthly/"
  const output = []
  var count = 0;
  const csvFilePath = folder + req.body.fileName
  
  csv()
  .fromFile(csvFilePath)
  .on('error', (err) =&gt; {
    console.log(err);
    res.send({success: false, message: err.message})
  })
  .then((jsonObj) =&gt; {
  
    jsonObj.forEach(function(value) {
  
      var originalDate = new Date(value['something'])
      var something= new Date(originalDate.setMonth(originalDate.getMonth() + 2));
  
      const body = new Report ({
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: value['something'],
        something: something.toLocaleDateString(),
        something: req.decoded.something
      })
  
      output.push(body);
  
  
    })
  
    //Everything up until this point runs perfectly 
    //This is where it crashes 
    Report.insertMany(output, function (err, results) {
      if (err) {
        console.log(err)
        res.send({success: false, message: err.message})
      } else {
        console.log(results);
        res.send({success: true, message: "Report Submitted"})
      }
    })
  })
  </code></pre>