When I open a popup window using sketch-module-webview, it is creating two processes (Sketch Web Content and Sketch Networking) per window (can be checked in activity monitor -> memory).
If I have only one window and I close it both these processes are removed from memory. But if call another window (B) from current window(A) then until I close both windows(A & B), these processes are not removed from memory. Could you help me with this?
Sample code:
function openWindowA() {
const options = {
identifier: 'window.a',
}
}
let browserWindow = new BrowserWindow(options)
browserWindow.on('closed', ()=> {
browserWindow = null
})
browserWindow.webContents.on('test', ()=> {
openWindowB()
})
browserWindow.loadURL(require('../a.html')) // has a button that will invoke openWindowB()
}
function openWindowB() {
const options = {
identifier: 'window.b',
}
}
let browserWindow = new BrowserWindow(options)
browserWindow.on('closed', ()=> {
browserWindow = null
})
browserWindow.loadURL(require('../b.html'))
}
As observed in activity monitor :
openWindowA (In memory: 1 sketch web content, 1 sketch networking)
close windowA (In memory: 0 sketch web content, 0 sketch networking)
openWindowA (In memory: 1 sketch web content, 1 sketch networking)
openWindowB from windowA (In memory: 2 sketch web content, 2 sketch networking)
close windowB (In memory: 2 sketch web content, 2 sketch networking)
open windowB(In memory: 3 sketch web content, 3 sketch networking)
close windowB (In memory: 3 sketch web content, 3 sketch networking)
close windowA (In memory: 0 sketch web content, 0 sketch networking)
Additional note:
This issue has been discussed in
https://github.com/skpm/sketch-module-web-view/issues/141
https://github.com/skpm/sketch-module-web-view/pull/161
But no working solution has been provided.