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 › Trouble with java.lang.OutOfMemoryError
Page Index Toggle Pages: 1
Trouble with java.lang.OutOfMemoryError (Read 801 times)
Trouble with java.lang.OutOfMemoryError
Sep 30th, 2005, 7:40pm
 
Hi,

I'm having trouble successfully running a sketch which is any bigger than 2700 X 2700 pixels.  

This sketch reads pixels data from an image, and draws a triangle for each pixel based on that pixels RGB values.  Here is an older version to give you an idea of what is going on: http://friendly.verywhere.org/josh/portfolio/colortriangles2.html

Everything is fine until I start to go big.  I was once able to run the sketch at 3000 X 3000 and create a .tiff file.  Now, I can't even create a blank sketch at 3000 X 3000, because I keep getting java.lang.OutOfMemoryError.  I am running on a dual processor G5 with 1GB of RAM.  Is this an issue with the computer or the limitations of Processing?  

My ultimate goal is to create a giant .tiff file which I could print 40" X 40" at 300 DPI.  In theory I could use AIExport, but these are big images that I am reading in (500KB+), and I don't know if Illustrator could handle such a huge file.

Anyone know how I can make this happen?


Code:

size(3000, 3000);
background(255);


PImage d = loadImage("DSC_0013.jpg");

color b;


for(int i=0; i<d.width*d.height; i++){




b = d.pixels[i];

int n=5;

int x1 = width/2;
int y1 = int(height/2-(red(b)*n));

int x2 = int(width/2-(green(b)*n)*cos(PI/6));
int y2 = int(height/2+(green(b)*n)*sin(PI/6));

int x3 = int(width/2+(blue(b)*n)*cos(PI/6));
int y3 = int(height/2+(blue(b)*n)*sin(PI/6));


stroke(red(b),green(b),blue(b),25);

noFill();
smooth();
triangle(x1,y1,x2,y2,x3,y3);

}
save("dad_alaska2.tiff");
Re: Trouble with java.lang.OutOfMemoryError
Reply #1 - Sep 30th, 2005, 10:31pm
 
http://processing.org/faq/bugs.html#memory

Check this out, you need to up the VM memory allocation in the processing prefs. Mine is default 256, so you'll want to slap it up to 1024, and then you should be ok.

Re: Trouble with java.lang.OutOfMemoryError
Reply #2 - Sep 30th, 2005, 10:34pm
 

I'm dumping out files in excess of 8mb to illustrator using AIExport, so your 500kb should present no problem at all.

Depends on the functionality you require at run-time. AIExport's going to slow down when you start writing, though I can tailor this a little depending on your requirements. simplePS is best on performance, but not functionality.

I find both are necessary
Re: Trouble with java.lang.OutOfMemoryError
Reply #3 - Oct 3rd, 2005, 8:33pm
 
Thanks, Mark.  I adjusted the VM memory, and things are running much more smoothly.

Page Index Toggle Pages: 1