title: java byte array memory not released
body: <p>Why each time I press the button the memory usage increased since I have set the pointer to NULL? (code attached)</p>
  
  <p>This makes my program continues to increase in memory usage. </p>
  
  <p>Thanks.</p>
  
  <pre><code>package newHashFunction;
  
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  
  public class Memory_not_released extends JFrame{
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          Memory_not_released memory_not_released=new Memory_not_released();
      }
  
      Memory_not_released(){
          JButton button1=new JButton("create bytes");
  
          button1.addActionListener(new ActionListener(){
              @Override
              public void actionPerformed(ActionEvent e) {
                  // TODO Auto-generated method stub
                  byte[] byte1=new byte[10000000];
                  byte1=null;
              }});
  
          add(button1);
  
          this.pack();
          setVisible(true);
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      }
  
  }
  </code></pre>