karma-chrome-launcher icon indicating copy to clipboard operation
karma-chrome-launcher copied to clipboard

--expose-gc flag not working

Open kortina opened this issue 7 years ago • 4 comments

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

kortina avatar Jun 13 '17 02:06 kortina

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.

corinadev avatar Jun 16 '17 12:06 corinadev

@ucorina almost:

        flags: [
          '--no-sandbox',
          '--user-data-dir=/tmp',
          '--disable-web-security',
          '--enable-logging=stderr',
          '--debug-devtools-frontend',
          '--js-flags="--expose-gc"'
        ],

mabedan avatar Dec 24 '18 08:12 mabedan

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 avatar Apr 12 '19 15:04 nurettin

@nurettin try without quotes, '--js-flags=--expose-gc' is working for me

TUNER88 avatar May 08 '19 11:05 TUNER88