Maximum Number of Items in an Array
in
Core Library Questions
•
10 months ago
Hey guys, I've built a playback device that uses a spinning encoder to play forwards and backwards through a video, divided into 1100 or so still frames. Unfortunately, no matter how much I compress the frames. The number of images I can load to memory maxes at 421, every time. I've compressed 1100 frames of 1260 by 720 jpeg images down to 28 mb and still no luck. To be clear, I get the "OutOfMemory" error even though I've maxed out the allowable memory in Processing's preferences." My OS is Windows 7 64 bit. I have 16 gb of RAM.
Any clue what may be the issue and any simple (fast?) solution to the problem? I appreciate any and all assistance.
Here's my code:
import fullscreen.*; //Imports the Fullscreen libraryimport processing.serial.*;
Serial myPort; // The serial portFullScreen fs; //Creates an object called fs from the FullScreen class
int numFrames = 1091; //Total number of frames including the 0int frame = 0;//Declares frame numberint val; // Data received from the serial portPImage[] images;//Creates and object called images from PImage classint width = 1280;int height = 720;void setup(){images = new PImage[numFrames];//Assignes and array to the images object that will hold 48 imagessize(width, height);frameRate(24);for ( int i = 0; i<numFrames; i++ )//A loop increments from 0 to 47{images[i] = loadImage("FriendlyFire_"+ i + ".jpg");//Assignes and exaxt name to each member of the array}//Note that this loop is an setup which means it will run only once when the program starts.
fs = new FullScreen(this); //Declares the fs object as new fullscreenfs.setResolution(1280, 720);fs.enter(); //runs the fullscreenString portName = Serial.list()[0];myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw(){background(0);
frame = ((frame+1) % numFrames);//Frame number increments until 48image(images[frame], 0, 0, width, height); //Displays the imageif ( myPort.available() > 0) { // If data is available,val = myPort.read(); // read it and store it in val}frame = val;}
1