title: Does the Arguments object leak?
body: <p>Assuming I had this sloppy-mode function, which (for some odd reason) returns its <code>arguments</code> object to the caller:</p>
  
  <pre><code>function example(a, b/* ...*/) {
      var c = // some processing
      return arguments;
  }
  </code></pre>
  
  <p>Does storing the result of an invocation (<code>var d=example();</code>) prevent the variable environment of <code>example</code> (containing <code>a</code>, <code>b</code>, <code>c</code> etc) from being garbage-collected? The internal setters and getters of the <a href="http://es5.github.com/#x10.6" rel="nofollow noreferrer">Arguments object</a> might still refer to it, just like a function returned from a closure does. Demo:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function example(a, b) {
    var c = Array(1000).fill(0); // some large object
    return {
      args: arguments,
      set: function(x) { a = x; },
      get: function() { return a; }
    };
  }
  var d = example('init');
  console.log(d.get());
  d.args[0] = 'arguments update'; // assigns the `a` variable
  console.log(d.get());
  d.set('variable update');
  console.log(d.args); // reads the `a` variable</code></pre>
  </div>
  </div>
  </p>
  
  <p>I know there is hardly a use case (and passing around Arguments objects is considered bad practice, most likely because of their similarity to arrays), but this is more a theoretical question. How do different EcmaScript implementations handle this? Is it implemented close to the spec?</p>
  
  <p>I would expect <code>c</code> to be garbage-collected <a href="https://stackoverflow.com/q/28388530/1048572">like with a normal closure</a> and not to be leaked, but what about <code>b</code>? What would happen if I <code>delete</code> the properties of the <code>arguments</code> object?</p>