title: java memory allocation for local variables
body: <p>I have a java application which uses a <strong>SerialPortEvent</strong> which will be called continously ,</p>
  
  <pre><code>public void serialEvent(SerialPortEvent evt) {
  
      if (evt.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
          try {
              StringBuilder sBuilder = new StringBuilder();
              int length = input.available();
              byte[] array = new byte[length];
              int numBytes = input.read(array);
  .......
  ......
  }
  </code></pre>
  
  <p>i print the <strong>array</strong> variable contents in a text pane.
  I have a scenario in which the event will be called continuosly , it makes the the windows Memory(private Working set) increase gradually and doesn't stop. </p>
  
  <p>My question is, whether creating new <strong>variables</strong> every time the event is called makes use of memory?? </p>
  
  <p>i simply get contents and print it in JTextpane and nothing else. </p>