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 when drawing
Page Index Toggle Pages: 1
Out of Memory when drawing (Read 880 times)
Out of Memory when drawing
Oct 10th, 2006, 7:21pm
 
Hi!

I've justed started a small video-project which uses an Array of PImage to show some kind of animation.

There is no problem with loading the images via

(...)

for (int i=0; i < 90; i++)
video_frames[i]=loadImage(file_base+i+"."+file_ext);

(...)

But when I try to draw 3 of them

for (int i=0; i<3; i++)
  image(video_frames[i],0,0);


my applet (browser) crashes with a heap out of memory message.

Is there any chance to get this running?

Thanks a lot in advance,

Chris
Re: Out of Memory when drawing
Reply #1 - Oct 13th, 2006, 9:01am
 
what size (width/height/colour depth) are your images?  you have to consider that images are stored in memory *uncompressed* after loading and decoding (AFAIK) – so just do the maths... if those images are not just thumbnail sized you might consequently want to switch to e.g. a quicktime based solution. even if you throttle your framerate to a reasonable amount and don't forget to redraw after each frame update – your code currently does neither ;-) – video without the least bit of optimisation (frame compression, delta compression, etc.) will definitely not work on an average computer running java, even less so in a browser.
Re: Out of Memory when drawing
Reply #2 - Oct 13th, 2006, 10:18am
 
if you want to use plenty of images, increase the memory.
http://processing.org/reference/troubleshooting/#memory
Re: Out of Memory when drawing
Reply #3 - Nov 30th, 2006, 2:29am
 
Unfortunately, increasing the JVM memory only works for applications, not for applets.
Re: Out of Memory when drawing
Reply #4 - Nov 30th, 2006, 3:02am
 
With the limited information from your original post, two possible solutions come to mind:

First, and easiest, would be to check to make sure that all of your images are compressed or otherwise optimized down to a rather low filesize. This may or may not help the issue, but it's an important first check.

Second, and more involved, would be to load the images in a dynamically allocated manner. Having a queue or buffered array would allow you to load images only when you need them.

The implmentation is somewhat involved, so tell me more about the problem, and how on the mark my thoughts are, and I can hopefully prototype something for you.
Page Index Toggle Pages: 1