title: setInterval jsf2.0 glassfish v3 and memory Leaks
body: <p>guys i'm new and i'm not english.
  I have a problem with using js setInterval that simulate a user click, every X seconds, on submit button.
  In the page there is only one h:form and h:commandButton.
  I use a profiler and i see that the java.util.HashMap increase continuosly it's size.
  After some hours the used heap size is growed a lot respect the start point.</p>
  
  <p>Please help me, this problem make me crazy.</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;?xml version = "1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"&gt;
      &lt;h:head&gt;
          &lt;script type="text/javascript"&gt;
              var timeoutId = window.setInterval( "userClick()" , 1000 );
          &lt;/script&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
      &lt;h:panelGroup id="testo"&gt;test&lt;/h:panelGroup&gt;
      &lt;h:form prependId="false" &gt;
          &lt;h:commandButton id="buttonId"
                           action="null"
                           value="Invia"&gt;
              &lt;f:ajax event="click" execute="@form" render=":testo"/&gt;
          &lt;/h:commandButton&gt;
      &lt;/h:form&gt;
      &lt;script type="text/javascript"&gt;
      function userClick()
      {
          document.getElementById('buttonId').click();
      }
      &lt;/script&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Update</strong>: After 1 days the application crash again.
  Now I have used only the setInterval but i have the heapDump generated by glassfish this is the screenshot but i'm unable to post it because my reputation is too low.
  however java.lang.Object[] consume 20% of heap, java.util.HashMap$Entry[]18% and HashMap 10%
  Any idea? </p>
  
  <p><strong>Update</strong>:
  Hi, guys i have solved my problem and have found a bug in CDI dependency/injection.
  I have solved my problem changing the Annotation @Named with @ManagedBean and this solve my problem.
  In the example i have omitted the code because i think that CDI haven't bug.
  Obviously the Bean annotated with @Named have request Scoped while the ApplicationScoped Bean doesn't produce the bug.
  I'm relatively new with CDI, so where i must report the bug?</p>