karma-chrome-launcher
karma-chrome-launcher copied to clipboard
--expose-gc flag not working
I have the following configuration for my karma runner:
browsers: ['Chrome_without_sandbox'],
customLaunchers: {
Chrome_without_sandbox: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--user-data-dir=/tmp',
'--disable-web-security',
'--enable-logging=stderr',
'--debug-devtools-frontend',
'--expose-gc',
],
},
},
I'd like to trigger garbage collection after some test runs, and have tried (all to no avail):
gc();
global.gc()
window.gc();
ProfilerAgent.collectGarbage();
Am I incorrectly setting the --expose-gc
flag?
cf. https://stackoverflow.com/questions/13950394/forcing-garbage-collection-in-google-chrome
Does it work if you pass expose-gc
as an option to js-flags
?
flags: [
'--no-sandbox',
'--user-data-dir=/tmp',
'--disable-web-security',
'--enable-logging=stderr',
'--debug-devtools-frontend',
'--js-flags="expose-gc"'
],
See http://peter.sh/experiments/chromium-command-line-switches/ and https://stackoverflow.com/questions/17777909/unit-testing-javascript-for-a-memory-leak for more reference.
@ucorina almost:
flags: [
'--no-sandbox',
'--user-data-dir=/tmp',
'--disable-web-security',
'--enable-logging=stderr',
'--debug-devtools-frontend',
'--js-flags="--expose-gc"'
],
I actually came across this problem, --expose-gc didn't work. Then I realized that it actually works when the page is first created, but then the website I visited goes on to delete it.
@nurettin try without quotes, '--js-flags=--expose-gc'
is working for me