title: Memory leak generating thumbnail
body: <p>When I use the code below I am experiencing a memory leak. Each time I run the code the memory consumption of the application goes up. Does anyone have any idea what I am doing with this code that causes it to keep increasing in memory consumption whenever that controller method is called?</p>
  
  <pre><code>BufferedImage originalImage = ImageIO.read(new File(pageService.getBaseLocation() + File.separator + page.getSha1()));
  if(originalImage != null){
      int type = originalImage.getType() == 0? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
          int width = new Double(originalImage.getWidth() * (300.0/originalImage.getHeight())).intValue();
          BufferedImage resizedImage = new BufferedImage(width,300, type);
          Graphics2D g = resizedImage.createGraphics();
          g.setComposite(AlphaComposite.Src);
          g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                  RenderingHints.VALUE_ANTIALIAS_ON);
          g.drawImage(originalImage, 0, 0, width, 300, null);
          g.dispose();    
  
  
  
  
  
  
          ImageIO.write(resizedImage,"png",response.getOutputStream());
  
  
          response.flushBuffer();
  
          response.getOutputStream().close();
  }                           
  </code></pre>