How to increase the maximum memory limit for an application created by an electronic developer?

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

I know what I can add --js-flags="--max-old-space-size=4096"at startup using an electron. But where should I put this parameter in the electronic builder assembly configuration?

+9
source share
2 answers

In main.js add:

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

According to the supported Chrome command line switches , this should be called before the event readyis dispatched. For instance:

import { app } from "electron";

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

app.on('ready', () => {
    // ...
});
+8
source

, max-old-space-size , -, (Start_WebviewPreload.ts):

import {remote} from "electron";
remote.app.commandLine.appendSwitch("js-flags", "--max-old-space-size=8192");

"main.js" ( ), . ( , Process Hacker 2, , , )

, , app.on("ready") - app.on("ready") - , , . ( -), .

, : , , /-.

0

Source: https://habr.com/ru/post/1676989/


All Articles