1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/devtools/gc/tests/objGraph.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +test(); 1.5 + 1.6 +function test() 1.7 +{ 1.8 + function generate_big_object_graph() 1.9 + { 1.10 + var root = {}; 1.11 + f(root, 17); 1.12 + return root; 1.13 + function f(parent, depth) { 1.14 + if (depth == 0) 1.15 + return; 1.16 + --depth; 1.17 + 1.18 + f(parent.a = {}, depth); 1.19 + f(parent.b = {}, depth); 1.20 + } 1.21 + } 1.22 + 1.23 + function f(obj) { 1.24 + with (obj) 1.25 + return arguments; 1.26 + } 1.27 + 1.28 + for(var i = 0; i != 10; ++i) 1.29 + { 1.30 + gc(); 1.31 + var x = null; 1.32 + x = f(generate_big_object_graph()); 1.33 + 1.34 + gc(); //all used 1.35 + 1.36 + x = null; 1.37 + 1.38 + gc(); //all free 1.39 + } 1.40 +}