As suggested up above in this thread, you could try System.gc to force the garbage collector but my unfortunate news is that I never solved this problem. I just ran it in P3D, which was a shame because it could have ran faster.
I tried to break P5 with this following test, but mostly it just locked up my system after 1000 iterations.
Code:
import processing.opengl.*;
PImage pimage;
int i = 0;
int count = 0;
void setup(){
size(400,400,OPENGL);
framerate(12);
}
void draw(){
pimage = loadImage("image" + i + ".gif");
image(pimage, 0, 0);
i = (i + 1) % 2;
println(++count);
}
You could perhaps rework your idea in Flash, constant image loading might be a bit more stable. Found a guide here:
http://www.kirupa.com/developer/mx2004/xml_slideshow.htm
Or you could try to get your image loading done in another thread, I believe there are posts on the forum on this subject. Some mention of it in the following url:
http://java.sun.com/developer/technicalArticles/Threads/applet/