js/src/devtools/gc/tests/objGraph.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 test();
     3 function test()
     4 {
     5   function generate_big_object_graph()
     6   {
     7     var root = {};
     8     f(root, 17);
     9     return root;
    10     function f(parent, depth) {
    11       if (depth == 0) 
    12           return;
    13       --depth;
    15       f(parent.a = {}, depth);
    16       f(parent.b = {}, depth);
    17     }
    18   }
    20   function f(obj) {
    21     with (obj)
    22       return arguments;
    23   }
    25   for(var i = 0; i != 10; ++i) 
    26   {
    27     gc();
    28     var x = null;
    29     x = f(generate_big_object_graph());
    31     gc(); //all used
    33     x = null;
    35     gc(); //all free
    36   }
    37 }

mercurial