title: out of memory error, java heap space
body: <p>I try to read log file with more than 4 million lines and size more than 400 MB, but I get <strong>Out of Memory Error : java heap space</strong>. This is my code :</p>
  
  <pre><code>File file = new File("C:\\file.log");
          FileReader fileReader = new FileReader(file);
          BufferedReader bufferedReader = new BufferedReader(fileReader);
          StringBuilder stringBuffer = new StringBuilder();
          String line;
          while ((line = bufferedReader.readLine()) != null) {
              stringBuffer.append(line);
          }
  </code></pre>
  
  <p>I tried to increase heap memory to 1GB, but still get that message. What would be the possible cause?</p>