Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Optionally exposing navigator.servo.garbageCollectAllContexts() outside about:... url scope for testing reasons #44878

@janeoa

Description

@janeoa

I am trying to run the tests/blink_perf_tests/perf_tests/ and the layout tests seem to heavily rely on tests/blink_perf_tests/perf_tests/resources/runner.js, which has this function:

   PerfTestRunner.gc = function () {
       if (window.GCController)
           window.GCController.collectAll();
       else {
           function gcRec(n) {
               if (n < 1)
                   return {};
               var temp = {i: "ab" + i + (i / 100000)};
               temp += "foo";
               gcRec(n-1);
           }
           for (var i = 0; i < 1000; i++)
               gcRec(10);
       }
   };

which tries to do "Garbage Collection" using so called window.GCController, which fails and runs recursive allocation till gc kicks in.

I wonder if we could use the navigator.servo.garbageCollectAllContexts() that is available on the about:memory page and is evoked when force gc button is pressed.

We could have a chromium style (--js-flags="--expose-gc") pref arg, so that the access to navigator.servo.garbageCollectAllContexts() is optional.

I want to implement this. Is it generally a good idea?
I speculate that this would reduce wait time in between blink-perf-tests and thus make total test time shorter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-feature-trackingThis issue tracks a particular high-level featureC-untriagedNew issues that haven't been triaged yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions