OutOfMemory while drawing images
in
Programming Questions
•
1 year ago
Hi,
this little "videoplayer" is supposed to load all the image files from a specified folder into a PImage-Array and draw them one after the other.
Problem is, it generates an OutOfMemory after drawing 53 to 54 frames. If I make it start from the beginning after frame 50 or so, everything works fine. It makes no sense to me. Shouldn't all the images have already been stored in the RAM after loading them into the array? Besides, there are only about 65 files in my test folder with a total size of 30MB, while my sketch can use up to 250MB of RAM..
this little "videoplayer" is supposed to load all the image files from a specified folder into a PImage-Array and draw them one after the other.
Problem is, it generates an OutOfMemory after drawing 53 to 54 frames. If I make it start from the beginning after frame 50 or so, everything works fine. It makes no sense to me. Shouldn't all the images have already been stored in the RAM after loading them into the array? Besides, there are only about 65 files in my test folder with a total size of 30MB, while my sketch can use up to 250MB of RAM..
- PImage[] rgbs;
int frame = 0, numpics;
void setup()
{
String path = selectFolder();
File file = new File(path);
String[] filenames = file.list();
numpics= filenames.length;
rgbs = new PImage[numpics];
for(int i=0;i<numpics;i++)
rgbs[i] = loadImage(path+"/"+filenames[i]);
size(rgbs[0].width,rgbs[0].height);
frameRate(12);
}
void draw()
{
image(rgbs[frame],0,0);
frame = frame < numpics-1? frame+1 : 0;
println(frame);
}
1