We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › out of memory error
Page Index Toggle Pages: 1
out of memory error (Read 363 times)
out of memory error
Apr 15th, 2008, 8:59pm
 
I have a simple script in which I am trying to load 8 jpeg images.  If I use a script that loads each image separately, I have no problem, but if I try to create the file names as the program runs, using an nf() command, I get an out of memory message. Here is the code, followed by the message it returns:

int numFrames = 8;
int frame = 0;
PImage[] images = new PImage[numFrames];

void setup()
{
 size(400,300);
 frameRate(10);
 
 for(int i=0; i<numFrames; i++) {
   String imageName = "cait " + nf(i, 3) + ".jpg";
   images[i] = loadImage(imageName);
 }
}

void draw()
{
 frame = (frame+1)%numFrames;  
 image(images[frame], 0, 0);
}


Exception in thread "Thread-2" java.lang.OutOfMemoryError: Java heap space
at processing.core.PImage.<init>(PImage.java:174)
at processing.core.PApplet.loadImageSync(PApplet.java:3672)
at processing.core.PApplet.loadImage(PApplet.java:3616)
at processing.core.PApplet.loadImage(PApplet.java:3563)
at Temporary_9844_9205.setup(Temporary_9844_9205.java:12)

The same type of message has been coming up for multiple other scripts as well, regardless of the size or complexity of them. Any idea how to resolve this issue?
Re: out of memory error
Reply #1 - Apr 16th, 2008, 11:04am
 
A search through the forum with the heap keyword revealed a previous post which may help you :

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1137161179
Re: out of memory error
Reply #2 - Apr 16th, 2008, 2:43pm
 
http://processing.org/reference/troubleshooting/index.html#memory
Page Index Toggle Pages: 1