I'm initiating a new BrowserWindow when the menu item is clicked from a Tray instance. Whenever the window is closed, it also quits the whole app including the Tray instance. To overcome that I'm using below code :
click: function ()
{
var win = new BrowserWindow({
width: 400,
height: 600,
resizable: false,
fullscreen: false,
title: 'About',
icon : __dirname+'/assets/logo/windowIcon.png'
})
win.setMenu(null)
win.loadURL(`file://${__dirname}/about.html`)
// win.webContents.openDevTools()
win.on('close', function (e)
{
e.preventDefault()
win.hide()
win.removeAllListeners('close')
})
}
But later I found that even after the window is closed the BrowserWindow instance is not discarded/release from the memory.
Every time that menu is clicked it opens a new Window but upon closing it, it is not released from the memory and the process just stacks up into the memory.
How do I release the BrowserWindow instance from the memory without terminating the Tray instance ?