Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/generators/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 837 B image not shown  

Quelle  bug1664463.js   Sprache: JAVA

 
// |jit-test| skip-if: !('gc' in this) || !('drainJobQueue' in this)
// Test that an unused local in an async function is not kept alive by a closure
// (bug 1412202). Based on a test case by Andy Wingo in bug 1664463.

let nfinalized = 0;
let finalizers = new FinalizationRegistry(f => { nfinalized++; });

class A {
  constructor(callback) {
    this.b = {callback};
    finalizers.register(thisthis.b, this);
  }
}

const LOOP_COUNT = 200;
const FINALIZER_COUNT = 200;

async function main() {
  for (let j = 0; j < LOOP_COUNT; j++) {
    for (let i = 0; i < FINALIZER_COUNT; i++) {
      let console = globalThis.console;
      let obj = new A(() => console.log("hello"));
    }
    drainJobQueue();
  }

  gc();
  drainJobQueue();
  assertEq(nfinalized, LOOP_COUNT * FINALIZER_COUNT, "all objects should be finalized");
}
main();

Messung V0.5
C=91 H=67 G=79

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.