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 & HelpPrograms › memory limits
Page Index Toggle Pages: 1
memory limits (Read 551 times)
memory limits
Apr 24th, 2008, 4:58pm
 
Hi,

I have a quick question,

I am about to start on a simple project which involves making an animation from a series of images. The question that I would like to ask before I begin is:

What is the memory management like in processing? Will I run into problems keeping a lot of images in memory eg stack overflow or does the garbage collection take care of unused images or can I delete them to free up the memory (I have had a quick look through the reference and can't find any methods for 'unloading' an image or 'deleting' an object (to use as3 style terms) ?

Any words of wisdom appreciated.
Re: memory limits
Reply #1 - Apr 24th, 2008, 7:01pm
 
Well so far I figured out that the gc is pretty smart in processing/java if I put a new reference into my array of references to image objects, it seems to be happy to remove the hanging references.

Also the very minimal streaming mechanism that I have written implies that processing is quite robust if I load an image at runtime into the index of the previously shown image I seem to be getting away without null reference exceptions; however I need to further testing because this seems suspiciously easy atm...
Re: memory limits
Reply #2 - Apr 25th, 2008, 5:56pm
 
I actually did get an "out of memory error" a few times when changing game levels with big textures in a short time.
You could fix that by starting your program with the java jvm parameter "-Xmx<MB>m"
For example "java -Xmx512m ..." would allocate 512 mb of ram for your program instead of the standard 64(?). But I use Eclipse for programming processing so I dont know how that can be done in the processing environment.
Re: memory limits
Reply #3 - Apr 26th, 2008, 8:55pm
 
the gc should clear out references that you're no longer using (e.g. array elements set to null) so long as nobody is pointing to them.

for out of memory errors and more memory info:
http://processing.org/reference/troubleshooting/index.html#memory
Re: memory limits
Reply #4 - Apr 29th, 2008, 12:21pm
 
Cheers guys Smiley
Page Index Toggle Pages: 1