| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-383269-02.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 383269; |
| 9 |
var summary = 'Leak related to arguments object'; |
| 10 |
var actual = 'No Leak'; |
| 11 |
var expect = 'No Leak'; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
test(); |
| 16 |
|
| 17 |
|
| 18 |
function test() |
| 19 |
{ |
| 20 |
enterFunc ('test'); |
| 21 |
printBugNumber(BUGNUMBER); |
| 22 |
printStatus (summary); |
| 23 |
|
| 24 |
function generate_big_object_graph() |
| 25 |
{ |
| 26 |
var root = {}; |
| 27 |
f(root, 17); |
| 28 |
return root; |
| 29 |
function f(parent, depth) { |
| 30 |
if (depth == 0) |
| 31 |
return; |
| 32 |
--depth; |
| 33 |
f(parent.a = {}, depth); |
| 34 |
f(parent.b = {}, depth); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
function f(obj) { |
| 39 |
with (obj) |
| 40 |
return arguments; |
| 41 |
} |
| 42 |
|
| 43 |
function timed_gc() |
| 44 |
{ |
| 45 |
var t1 = Date.now(); |
| 46 |
gc(); |
| 47 |
return Date.now() - t1; |
| 48 |
} |
| 49 |
|
| 50 |
var x = f({}); |
| 51 |
x = null; |
| 52 |
gc(); |
| 53 |
var base_time = timed_gc(); |
| 54 |
|
| 55 |
x = f(generate_big_object_graph()); |
| 56 |
x = null; |
| 57 |
gc(); |
| 58 |
var time = timed_gc(); |
| 59 |
|
| 60 |
if (time > (base_time + 10) * 3) |
| 61 |
actual = "generate_big_object_graph() leaked, base_gc_time="+base_time+", last_gc_time="+time; |
| 62 |
|
| 63 |
reportCompare(expect, actual, summary); |
| 64 |
|
| 65 |
exitFunc ('test'); |
| 66 |
} |