title: java Memory Leaks and grow Surviving Generations
body: <p>i have problem with my project that need send many of request to server </p>
  
  <p>problem is continues growing Surviving Generations ..</p>
  
  <p>i develop my project with Netbeans IDE and i am using NetBeans Profiler to detect a Memory Leak .</p>
  
  <p>i created a class for testing:</p>
  
  <p><strong>test class</strong></p>
  
  <pre><code>public class test {
  
      public test(String url) throws IOException {
          CloseableHttpClient client = HttpClientBuilder.create().build();
          HttpGet request = new HttpGet(url);
          client.execute(request);
          System.out.println("\nSending 'GET' request to URL : " + url);
      }
  
  }
  </code></pre>
  
  <p><strong>main class</strong></p>
  
  <pre><code>public class Main {
      public static void main(String[] args) throws IOException, InterruptedException {
  
          for (int i = 1; i &lt; 10000; i++) {
              new test("http://foo.dev/article?id="+i);
          }
      }
  }
  </code></pre>
  
  <p><strong>NetBeans Profiler results:</strong></p>
  
  <p><strong>Surviving Generations</strong>
   <a href="https://i.stack.imgur.com/rBEi5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rBEi5.png" alt="Generations Result"></a>
  <strong>Heap Result</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ZZ49Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZZ49Z.png" alt="Heap Result"></a></p>
  
  <p><strong><em>netbeans site</em></strong>:</p>
  
  <blockquote>
    <p>Typically, the Surviving Generations value starts to grow during an
    application's startup, but after some time it should reach some stable
    limit and level off. When this happens it indicates that no objects
    are being created continuously and leaking. If the Surviving
    Generations line continues to grow all the time (regardless of how
    quickly), then the application is most likely leaking.</p>
  </blockquote>
  
  <p><strong>my question</strong> is why Surviving Generations line continues to grow and What is the cause in my Code ?</p>
  
  <p>any help please...</p>