title: How to keep ChildProcess from running out of memory? Electron/Node.js
body: <p>Using Electron and Node.js to write a simple user interface to a process that generates data, and then allows the user to call gnuplot to show the data. Here is the code in main.js that calls gnuplot (gnuplot5-qt).</p>
  
  <pre><code>var menu = Menu.buildFromTemplate([
    {
        label: 'Run Graph',
        click() {
          commandLine()
        }
    },
  // Other code
  function commandLine () {
      var child = require('child_process').execFile;
      var executablePath = "/usr/bin/gnuplot";
      var parameters = ["-p","-e","filename='/home/prog1/PP_Logs/log1.txt'","/home/prog1/plot_log.p"];
  
      child(executablePath, parameters, function(err, data) {
        console.log(err);
        console.log(data.toString());
      });
  </code></pre>
  
  <p>gnuplot always opens, sometimes it stays open and I can exit it normally, but randomly it will close immediately after opening and prints the following error:</p>
  
  <pre><code>{ Error: Command failed: /usr/bin/gnuplot -p -e filename='/home/prog1/PP_Logs/log1.txt' /home/prog1/plot_log.p
  
  at ChildProcess.exithandler (child_process.js:282:12)
  at emitTwo (events.js:125:13)
  at ChildProcess.emit (events.js:213:7)
  at maybeClose (internal/child_process.js:921:16)
  at Socket.stream.socket.on (internal/child_process.js:348:11)
  at emitOne (events.js:115:13)
  at Socket.emit (events.js:210:7)
  at Pipe._handle.close [as _onclose] (net.js:549:12)
  killed: false,
  code: null,
  signal: 'SIGSEGV',
  cmd: '/usr/bin/gnuplot -p -e filename=\'/home/prog1/PP_Logs/log1.txt\' /home/prog1/plot_log.p' }
  </code></pre>
  
  <p>This same code works without issue if gimp is launched instead of gnuplot:</p>
  
  <pre><code> var executablePath = "/usr/bin/gimp";
   var parameters = ["-s","/home/geenweb/Pictures/lgcm110.jpg"];
  </code></pre>
  
  <p>Given the SIGSEGV, I'm assuming that gnuplot is running out of memory when it crashes. Is there some way to allocate more memory? Is there a better way to call gnuplot? I'm just learning Electron, Node.js, and javascript. Thanks for your help.</p>