Java Memory Leak Issue with JPanels
<p>Java Memory Leak</p>

<pre><code>private boolean refreshResponseWindow(MessageObject message) {
  this.responsePanel.removeAll();
  this.responsePanel.add(message.buildGUI());
  this.responsePanel.validate();
  message = null;
  return true;
</code></pre>

<p>}</p>

<p>The problem that is occurring is as I receive more and more messages my Java program's memory usage continues to grow eventually causing it to lock up.  I've isolated my memory leak to the code above specifically the add procedure call.  I'd assume the removeAll would clear the contents of my panel but it still seems to continue to grow.</p>

<p>Note: The message.buildGUI() returns a JPanel that is displayed on the responsePanel</p>

<p>Follow up:</p>

<p>The BuildGUI code appears as such</p>

<pre><code>public JPanel buildGUI() throws Exception {
    JPanel busPanel = new JPanel();
    busPanel.setLayout(new GridBagLayout());
    busPanel.setPreferredSize(new Dimension(Globals.panelW, Globals.panelH));
    busPanel.setMinimumSize(new Dimension(Globals.panelW, Globals.panelH));

    final JLabel headingLabel = new JLabel();
    headingLabel.setFont(new Font("", Font.PLAIN, 18));
    headingLabel.setText(this.name);
    final GridBagConstraints gridBagConstraints_heading = new GridBagConstraints();
    gridBagConstraints_heading.gridwidth = 2;
    gridBagConstraints_heading.gridy = 0;
    gridBagConstraints_heading.gridx = 0;
    busPanel.add(headingLabel, gridBagConstraints_heading);
    //Many more gui components marked as final
    return busPanel;
</code></pre>

<p>There are no listeners the returned panel is for display purposes only.  </p>
