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 › Image Viewer
Page Index Toggle Pages: 1
Image Viewer (Read 421 times)
Image Viewer
Dec 20th, 2008, 11:50am
 
I am creating an Image Viewer for a project at university. The project is not complete but I am having some issues.

Basically the project will load any images which can be found (and are compatiable) in the same folder as the sketch and then allow you to do the following with them:

'RIGHT ARROW' = previous image
'LEFT ARROW' = next image
'-' = zoom out
'+' = zoom in

The issue I have is with memory, if more than about 10 images are used, the RAM used is quite substantial and it gradually increases whilst the program is running, if you could look at my code to see if its something to do with the way I create my PImage array or if this is a general processing issue.

I have checked the http://processing.org/reference/troubleshooting/#memory and if I increase the memory allowance it no longer throws up error, but I still feel like its using too much.

Here is my code: http://pastebin.ca/1290134

Thanks in advance for looking at this.
Re: Image Viewer
Reply #1 - Dec 21st, 2008, 6:30am
 
Maybe this faq could help:

http://www.processing.org/reference/troubleshooting/#memory
Re: Image Viewer
Reply #2 - Dec 21st, 2008, 11:50am
 
As you can see from my original post, i have checked that section of the FAQ, and to confirm, it stops my processing from giving my out of memory errors, but I still find the amount of memory used to be far too high and thats what I am looking to solve.

Thanks for your help though.
Re: Image Viewer
Reply #3 - Dec 21st, 2008, 3:35pm
 
Uh. Yeah. Oops.  Sorry! Teaches me not to reply to posts early in the morning Tongue


Perhaps you can use something like a buffer? A general description:

ArrayList imgFiles = new ArrayList();

LinkedList imgs = new LinkedList();


//initiate imgFile locations

[1 2 3 4 5 6 7 8 9] <- this is the buffer
        *          <- current location

//use threaded loader to fill these buffers with files indicated by imfFiles.

When moved, you can evaluate the location and remove image outside of range.

I believe I used a simpler version to solve the memory problem.

Since people usually go forward much quicker, maybe more buffer should be given to forward direction.
Page Index Toggle Pages: 1