FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   [ java.lang.OutOfMemoryError ] --
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: [ java.lang.OutOfMemoryError ] --  (Read 285 times)
gll

WWW Email
[ java.lang.OutOfMemoryError ] --
« on: Feb 16th, 2004, 5:53am »

I had a problem since some much time now. I'm turning around on this specific problem and I'm running out of ideas.
 
I'm trying to load a massive number of images (.jpg). I made a class for my set. Everything is fine for 67 pictures but over, it gives me an error --[java.lang.OutOfMemoryError]--.
 
I copy a part of the code here, maybe someone had the same trouble once.
 
Could it be my Java settings? How could I change the maximum amount of memory?
 
 
//----------------------------------
 
BmpSet[] CB = new BmpSet[2];
 
void setup()
{
  size(640,480);
  framerate(30);
  CB[0] = new BmpSet(67);
}
 
 
class BmpSet{
  BImage[] n;
  int elements;
 
  BmpSet(int elements){
    this.elements = elements;
    this.n = new BImage[elements];
    loadBMP();
  }
 
  void loadBMP()
  {
    String[] fileName = new String[2];
    fileName[1] = ".jpg";
 
    for (int i=0; i<elements; i++)
    {
 fileName[0] = nf(i, 3);
 String loadBMP = join(fileName,"");
 n[i] = loadImage(loadBMP);
    }
  }
}
 
//----------------------------------
 

guillaume LaBelle
toxi_
Guest
Email
Re: [ java.lang.OutOfMemoryError ] --
« Reply #1 on: Feb 16th, 2004, 1:18pm »

it is (possibly) the java memory setting but might also be you're running out of ram on a system level. under windows you can change the settings in the "run.bat" file in the processing folder. the default is 128MB. have a look at the "-ms128m -mx128m" command line arguments...
 
now, 67 instances of a 640*480 image will "only" occupy: 67*640*480*4 bytes = 78.5MB. so that would indicate that java can't actually get hold of the requested 128MB, so might want to close some other apps, increase your pagefile size and/or buy more RAM
 
gll

WWW Email
Re: [ java.lang.OutOfMemoryError ] --
« Reply #2 on: Feb 16th, 2004, 6:00pm »

Thanks Toxi.
 
Now I can fill my memory of Images. I ran many calcultaions on this system of 2go of Memory (for Cad Software). Normaly, I don't use that much memory. I changed the Experts settings for 512mb and I don't have the error. Strangely, it seems to be more rapid.
 
Everything is now fixed. Thanks.
 

guillaume LaBelle
gll

WWW Email
Re: [ java.lang.OutOfMemoryError ] --
« Reply #3 on: Feb 16th, 2004, 7:36pm »

//----------(+)
 
Is the movie (mov+avi) formats could be rapid enough to have an instant control on each frames to jump from one to the others? I used individual jpgs because it seems the best way to avoid slow changes.
 
With codecs, Video might be slower it won't be stroboscopic.
« Last Edit: Feb 25th, 2004, 6:21pm by gll »  

guillaume LaBelle
Pages: 1 

« Previous topic | Next topic »