We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi everyone, I am creating an app that can capture images from a webcam and display them back to the user. In the Processing window, there is a main screen that will show the live cam feed and the most recent two images. Below the main screen, there is a preview slider panel that shows the captured images in a smaller size. I use the spacebar to capture the images into an arraylist of PImages.
The problem that I have been trying to solve is that I keep getting an out of memory error when I reach about 30 frames or so. I already tried increasing the heap space size to about 1 gig using the "-Xms512M -Xmx1024M" in Eclipse run configuration. Theoretically, since the maximum size of my arraylist is 150 PImages, with each PImage of about 1280x720 pixels, my programme should never hit anywhere near the max limit of 1 gigabyte.
I suspect that there is a memory leak somewhere but I don't know what is causing it. The error message in the Processing IDE says that I am perhaps trying to display thousands of images at once but I am only trying to display around ten images at any point of time.
I have isolated the portion of my code with this issue into a small Processing sketch which can be cut and paste from here:-
Do note that to run the code, you need to change the cameraNameString to that of your webcam, preferably around 1280x720 resolution also.