All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rhino1.7.7.testsrc.tests.e4x.GC.regress-324278.js Maven / Gradle / Ivy

Go to download

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.

There is a newer version: 1.7.15
Show newest version
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

gTestfile = 'regress-324278.js';

//-----------------------------------------------------------------------------
var BUGNUMBER = 324278;
var summary = 'GC without recursion';
var actual;
var expect;

printBugNumber(BUGNUMBER);
START(summary);

var N = 1000 * 1000;

print("N = " + N);

function prepare_list(N)
{
    var cursor = null;
    for (var i = 0; i != N; ++i) {
        var ns = new Namespace("protocol:address"); 
        ns.property = cursor;
        var xml = ;
        xml.addNamespace(ns);
        cursor = {xml: xml};
    }
    return cursor;
}

print("preparing...");

var list = prepare_list(N);

print("prepared for "+N);
gc();

var count = 0;
while (list && list.xml.inScopeNamespaces().length > 0 && list.xml.inScopeNamespaces()[1]) {
        list = list.xml.inScopeNamespaces()[1].property;
        ++count;
}

expect = N;
actual = count;

TEST(1, expect, actual);

gc();
 
END();




© 2015 - 2024 Weber Informatics LLC | Privacy Policy