Skip to content

Memory leak in process.registerSchemesAsPrivileged #20517

Description

@HaNdTriX

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • v7.0.0-beta.6
  • Operating System:
    • macOS Mojave 10.14.5
  • Last Known Working Electron version:
    • v6.0.12

Expected Behavior

The electron helper process should not eat up memory.

Screenshot 2019-10-10 at 11 29 35

Actual Behavior

An electron helper process eats up memory in a linear way

Screenshot 2019-10-10 at 11 23 35

Electron Helper_48309 (1)

To Reproduce

Example Repositiory

Here is a minimal reproduction example: https://github.com/HaNdTriX/electron-memory-leak

$ git clone [email protected]:HaNdTriX/electron-memory-leak.git
$ cd electron-memory-leak
$ npm install
$ npm start

After starting the app please take a look at its memory usage.

Code

const { session, app, protocol, BrowserWindow } = require('electron')
const { join } = require('path')

protocol.registerSchemesAsPrivileged([{
  scheme: 'atom',
  privileges: {
    // The following setting
    // is causing the memoryleak
    standard: true
  }
}])

app.on('ready', () => {
  session.defaultSession.protocol.registerFileProtocol('atom', (request, callback) => {
    callback({
      path: join(__dirname, 'index.html')
    })
  })

  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  })

  mainWindow.loadURL(`atom://foobar`)
})

Screenshots

See above...

Additional Information

I've tracked down the bug to registerSchemesAsPrivileged and its standard setting.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions