| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'regress-324278.js'; |
| 7 |
|
| 8 |
|
| 9 |
var BUGNUMBER = 324278; |
| 10 |
var summary = 'GC without recursion'; |
| 11 |
var actual; |
| 12 |
var expect; |
| 13 |
|
| 14 |
printBugNumber(BUGNUMBER); |
| 15 |
START(summary); |
| 16 |
|
| 17 |
var N = 1000 * 1000; |
| 18 |
|
| 19 |
print("N = " + N); |
| 20 |
|
| 21 |
function prepare_list(N) |
| 22 |
{ |
| 23 |
var cursor = null; |
| 24 |
for (var i = 0; i != N; ++i) { |
| 25 |
var ns = new Namespace("protocol:address"); |
| 26 |
ns.property = cursor; |
| 27 |
var xml = <xml/>; |
| 28 |
xml.addNamespace(ns); |
| 29 |
cursor = {xml: xml}; |
| 30 |
} |
| 31 |
return cursor; |
| 32 |
} |
| 33 |
|
| 34 |
print("preparing..."); |
| 35 |
|
| 36 |
var list = prepare_list(N); |
| 37 |
|
| 38 |
print("prepared for "+N); |
| 39 |
gc(); |
| 40 |
|
| 41 |
var count = 0; |
| 42 |
while (list && list.xml.inScopeNamespaces().length > 0 && list.xml.inScopeNamespaces()[1]) { |
| 43 |
list = list.xml.inScopeNamespaces()[1].property; |
| 44 |
++count; |
| 45 |
} |
| 46 |
|
| 47 |
expect = N; |
| 48 |
actual = count; |
| 49 |
|
| 50 |
TEST(1, expect, actual); |
| 51 |
|
| 52 |
gc(); |
| 53 |
|
| 54 |
END(); |