title: Fastest way to free BufferedImage memory
body: <p>What is the fastest way to save a BufferedImage to disk (in order to free memory)?</p>
  
  <p>My Java application processes loads of images (an image is loaded to memory every ~300ms). Most of those images are discarded (gc) quite immediately, but every once in a while I need to save an image. </p>
  
  <p>Of course, keeping those in RAM is not a good idea, for it eats up an average 2GB JVM in minutes, and crushes the application, so I tried saving it to disk. The problem is, saving it with <code>ImageIO.write(img, "PNG", file)</code> is not sufficient enough, because it sometimes takes (on my i7 machine) 5-10 second per 12MB image to process and save, and still doesn't free the memory fast enough. </p>
  
  <p>Is there another format that might perform faster?</p>
  
  <h3>EDIT:</h3>
  
  <p>I don't care to lower resolution or loose image data at reasonable level.</p>