Browse Source

clear hep memory

qortal-ui-dev^2
AlphaX-Projects 1 year ago
parent
commit
03f67deb89
  1. 23
      electron.js

23
electron.js

@ -41,19 +41,16 @@ crashReporter.start({
uploadToServer: false uploadToServer: false
}) })
if (myMemory > 16000000000) { app.commandLine.appendSwitch('js-flags', '--max-executable-size=192 --max-old-space-size=1024 --max-semi-space-size=2')
app.commandLine.appendSwitch('js-flags', '--max-old-space-size=8192')
log.info("Memory Size Is 16GB Using JS Memory Heap Size 8GB") setInterval (function() {
} else if (myMemory > 12000000000) { let mu = process.memoryUsage()
app.commandLine.appendSwitch('js-flags', '--max-old-space-size=6144') log.info('heapTotal:', mu.heapTotal, 'heapUsed:', mu.heapUsed);
log.info("Memory Size Is 12GB Using JS Memory Heap Size 6GB") if (mu.heapUsed > 1024 * 1024 * 1024) {
} else if (myMemory > 7000000000) { log.info('Taking out the garbage')
app.commandLine.appendSwitch('js-flags', '--max-old-space-size=4096') global.gc()
log.info("Memory Size Is 8GB Using JS Memory Heap Size 4GB") }
} else { }, 1000 * 120)
app.commandLine.appendSwitch('js-flags', '--max-old-space-size=2048')
log.info("Memory Size Is 4GB Using JS Memory Heap Size 2GB")
}
if (process.arch === 'arm') { if (process.arch === 'arm') {
app.disableHardwareAcceleration() app.disableHardwareAcceleration()

Loading…
Cancel
Save