title: Why a sawtooth shaped graph?
body: <p>When I run the below mentioned code using NetBeans, the allocated heap size graph resembles a sawtooth shape. I am attaching the screen capture from JVisualVM which shows the heap allocation graph in with a sawtooth shape. The program is a simple infinite loop printing "Hello, World!" into the console.</p>
  
  <pre><code>public class HelloWorld {
      public static void main(String a[]){
          while(true) {
              System.out.println("Hello, World!");
          }
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/O2KFi.png" alt="enter image description here">
  Can anyone explain the reason behind the shape of the graph of used heap?</p>
  
  <p><strong>PS</strong>: This happens even if I run it without using NetBeans, so it is most likely not related to NetBeans...</p>