Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the max memory limit for the app built by electron-builder?

  • Version: "electron": "1.6.2", "electron-builder": "^16.8.2",
  • Target: windows x64

I know I can add --js-flags="--max-old-space-size=4096" when run it using electron. But Where should I put this param to the build config of electron-builder?

like image 314
user1349923 Avatar asked May 12 '17 09:05

user1349923


1 Answers

In main.js, add:

app.commandLine.appendSwitch('js-flags', '--max-old-space-size=4096');

According to Supported Chrome Command Line Switches, this should be called before the ready event is emitted. For example:

import { app } from "electron";

app.commandLine.appendSwitch('js-flags', '--max-old-space-size=4096');

app.on('ready', () => {
    // ...
});
like image 137
user1349923 Avatar answered Sep 23 '22 02:09

user1349923