Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--expose-gc flag not working #138

Open
kortina opened this issue Jun 13, 2017 · 4 comments
Open

--expose-gc flag not working #138

kortina opened this issue Jun 13, 2017 · 4 comments

Comments

@kortina
Copy link

kortina commented Jun 13, 2017

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 kortina changed the title expose-gc flag not working --expose-gc flag not working Jun 13, 2017
@corinadev
Copy link

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.

@mabedan
Copy link

mabedan commented Dec 24, 2018

@ucorina almost:

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

@nurettin
Copy link

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.

@TUNER88
Copy link

TUNER88 commented May 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants