title: Memory Leaks using Executors.newFixedThreadPool()
body: <p>I am using Spring3.1 on a standalone env.</p>
  
  <p>(this problem not necessary related to Spring. it's behaving the same also on a standalone env.)</p>
  
  <p>I have implements a listener which receives messages from Topic. the messages rate is very very high (talking about 20/30 m/s). </p>
  
  <p>some messages can take more processing time then other.</p>
  
  <p>The listener works with the same instance which means that if one message being processed too long it hits our performances pretty much.</p>
  
  <p>We thought about doing our own pool of objects instead of using the same listener instance but then I found out the <strong>Executors</strong>(java.util.concurrent.Executors). </p>
  
  <p>So for each message received a different thread will be allocated to it. this will make sure our listener instance will be free to process messages parallel. </p>
  
  <pre><code>private ExecutorService  threadPool = Executors.newFixedThreadPool(100);
      @Override
      public void onMessage(final Message msg)
      {
          Runnable t = new Runnable()
          {
              public void run()
              {
                  onSessionMessage(msg);
                  log.trace("AbstractSessionBean, received messge");
              }
          };
          threadPool.execute(t);
      }
  </code></pre>
  
  <p>That seems to solve our performance issue. but after monitoring the application with jconsole we facing now huge memory leaks. </p>
  
  <p>The heap memory usage being increased significantly in time.</p>
  
  <p>So I tried to "play" a bit with the FixedThreadPool size number. still having huge memory usage:</p>
  
  <p><img src="https://i.stack.imgur.com/NlsbR.jpg" alt="enter image description here"></p>
  
  <p>Any idea how can I solve this? any other ideas to solve my key problem?</p>
  
  <p><img src="https://i.stack.imgur.com/SlQXP.jpg" alt="jconsole after performing GB"></p>
  
  <p><img src="https://i.stack.imgur.com/8lWq4.jpg" alt="jconsole overall view"></p>
  
  <p>After running heap dump I got two problem suspects:</p>
  
  <p><img src="https://i.stack.imgur.com/rhG0G.jpg" alt="Head Dump"></p>
  
  <p>thanks,
  ray.</p>