title: Do unclosed streams cause memory leaks in java?
body: <p>I believe open streams cause memory leak in java (at least java 1.6 and earlier did had this problem). </p>
  
  <p>But, while searching (even here), I found some people agreeing with this while others do not. So, if I write this program:</p>
  
  <pre><code>import java.io.*;
  public class CreatingMemoryLeak {
  
      public static void main(String args[])
      {
          String s = "xxxxxxx";
          InputStream in = new ByteArrayInputStream(ss.getBytes());
          BufferedInputStream bf = new BufferedInputStream(in);
  
          try {
              while(bf.read()&gt;0)
              {
                  System.out.println("got it");
              }
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println("Here is a input stream " + s +" causing a memory leak");
  
      }
  }
  </code></pre>
  
  <p>and if I do not close the <code>bf</code> stream explicitly, will it cause a memory leak? </p>