title: OutOfMemory when manipulating images
body: <p>This produces an OutOfMemory exception after running for a few seconds. Any ideas?</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>PGraphics img;
  
  void setup() {
    size(500, 500);
    img = createGraphics(width, height, JAVA2D);
  
    // this is here just for the testcase because else I get a
    // NullPointerException too (probably a harmless Processing bug)
    img.beginDraw(); img.endDraw();
  }
  
  void draw() {
    PGraphics tmpImg = createGraphics(img.width, img.height, JAVA2D);
    tmpImg.beginDraw();
    tmpImg.image(img, 0, 0);
    tmpImg.endDraw();
    tmpImg.dispose();
  }
  </code></pre>