title: Is my Glassfish setup leaking memory?
body: <p>I've got a Glassfish v3 server running a few web applications (servlets, JSP, JDBC). I'd been noticing that if I let Glassfish run for a long time, it will consume all of the memory available (this is running on a server with 750 MB of memory).</p>
  
  <p>I figured that there must be a memory leak, so I ran the server while monitoring it with JProfiler and noticed that when I get a peak in traffic, my memory usage shoots up (as expected), but then quickly drops back down.</p>
  
  <p>I'm wondering if the issue is less of a memory leak, and more that Glassfish expands its heap size when the spikes occur (this does seem to be happening) but never decreases the heap size when the actual memory usage declines.</p>
  
  <p><img src="https://i.stack.imgur.com/0wUtB.png" alt="Graph of heap for Glassfish"></p>
  
  <p>However, based on this graph, it does seem like the memory usage (blue) <em>is</em> trending upwards as the server runs longer.</p>
  
  <p>My question is two-fold:</p>
  
  <ol>
  <li><p>Is there any way to have the heap size decreased when the actual memory usage drops after a spike?</p></li>
  <li><p>Is it probable that I do have a memory leak, or is this normal? What can I do to investigate this memory usage further?</p></li>
  </ol>